Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling to Child Method doesn't working #4

Open
carmineromano995 opened this issue Jul 18, 2022 · 4 comments
Open

Calling to Child Method doesn't working #4

carmineromano995 opened this issue Jul 18, 2022 · 4 comments

Comments

@carmineromano995
Copy link

carmineromano995 commented Jul 18, 2022

No description provided.

@jmpisson
Copy link
Owner

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!

@carmineromano995
Copy link
Author

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

@jmpisson
Copy link
Owner

jmpisson commented Aug 2, 2022

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.

@carmineromano995
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants