lightning-wizard
lightning-wizard copied to clipboard
Calling to Child Method doesn't working
Hi @carmineromano99! Sorry for the delayed response; I will test the behaviour, but at first I think you should use this.querySelector('c-asset-move-search-account');. Your component c-asset-move-search-account is child from the template of c-wizard.
When you are triggering logic from c-wizard-step, c-asset-move-search-account lives on the slot, and it is not part from the parent template, so in this case you should use directly this.querySelector.
Hope it helps!
Hi @jmpisson It works, thanks a lot.
Do you know if It's possible to set variables in a parent lwc of c-wizard-step? When the method set in the before-change attribute fires, "this" variable is set on c-wizard-step. For example in the LWC createAccountWizard I created a variable that I would set in the before-change method of step 1. When I'm in the Step 2 the variable of createAccountWizard is Undefined
Hi @carmineromano995! By design, I decided to make the validation aware only on the step, so currently it's not possible in a standardized way to set a variable on top of c-wizard-step - I have planned to include the parent directly on the validation, but I haven't work on this feature still.
Maybe the easiest way to share a context between your steps is to use a shared module between components - this way you could store the form state between all steps.
Hi @jmpisson, I'll share a use case: I need to take some information from the User input in each Step and only in the last step use the user input/selection to do some operation (Eg: Insert a record). Each step can contain LWC child where the user makes some input info, chooses a row from a data table, or search record from a search bar. In the before-change event of each step, I would like to save the user input/selection in the parent LWC for using them in the last Step.
I hope I was clear.
Thanks