Hello awesome people at SurveyJS,
Need urgent help!!!
So I need to load 2 different restful dropdown questions but these 2 dropdown question can only load when a parent dropdown(restful again) selected. So these selected parent id need to pass to api to fetch and load those 2 dependent dropdown. Now these entire setup should run inside a dynamic panel.
I have achieved this by using
Step 1 - onAfterRenderQuestion => fetch the data for parent dropdown and set it.
Step 2 - onValueChanged => get the parent id and fetch the child data and set accordingly
We have a draft functionality in our application(so you can partially fill the survey and later you can complete it, to achieve that we have the surveyModel.onComplete handler and we set the string data in data base and later we can fetch it and set it again in the surveyModel.data property).
Now my problem is when I set the surveyModel.data next time because the parent dropdown is a restful choice is not loaded yet and the correct data is not set.
Note: To load all the dropdown questions I am using choicesByUrl
Codequestion.choicesByUrl.url = environment.baseUrl + '/api/definitions?type=whatever; question.choices = []; question.choicesByUrl.updateResultCallback = ((request, server) => { return server; }); question.choicesByUrl.run();
Any example code will be highly appreciated.
Thanks in advance.