Hi Team,
I have learned that the only way to embedded html button in Surveyjs is by using custom widget.
So, there's a requirement in my project which is as follow :
- There are 2 panels, Panel 1 and Panel 2.
- Panel 1 will be in expanded state and Panel 2 will be in collapsed state initially.
- Panel 1 has a button developed using custom widget with label Navigate to next section
- On clicking this Navigate to next section, I need to collapse panel 1 and expand panel 2 programmatically.
I have tried out writing following code inside button.onclick
function in my custom-widget ::
TypeScriptsurveyModel.getPanelByName("panel1").collapse();
surveyModel.getPanelByName("panel2").expand();
For this, I actually had to rewrite the following in my custom-widget,
TypeScriptconst surveyModel = new Survey.Model(json);
Now, this code was neither expanding panel2 nor collapsing panel1.
I found out that I will need to call survey.render()
again to update the survey as suggested in this link.
The issue here is, I will need to place Survey.SurveyNG.render("surveyElement", { model: surveyModel })
inside the custom-widget, which is actually creating a new wrapper and in turn removing all the properties/validations I have placed inside my survey.component.ts file.
I have created a plunker, please help me to navigate to panel2 programmatically on Navigate to next section button click.
Please find the plunker link here.