Question T5072
Visible to All Users

survey.onAfterRenderSurvey event is not working

created 4 years ago

Hi Team,
I have been trying to fire the onAfterRenderSurvey event but it is not working also the I have tried all events of onAfterRender* like Page , question they were also not working but onComplete is working fine. Can you please check what am I missing. Following is my code snippet. Thanks.

ngOnInit() {

this.surveyService.getQuestionaire().subscribe((response:HttpResponse<any>)=>{
      if(response.status === 200){
        this.surveyJSON= response.body.questionnaire;
         this.showServey(this.surveyJSON);
      }
    });
}

showServey(surveyJSON) {
    Survey.StylesManager.applyTheme("bootstrap");
    var survey = new Survey.Model(surveyJSON);
    survey.onComplete.add(this.sendDataToServer.bind(this));
    survey.render("surveyElement", { model: survey });
    survey.onAfterRenderSurvey.add(function(survey){
      console.log("Hello world");
    })

}

Answers approved by surveyjs Support

created 4 years ago

Hello,

JavaScript
Survey.StylesManager.applyTheme("bootstrap"); var survey = new Survey.Model(surveyJSON); survey.onComplete.add(this.sendDataToServer.bind(this)); survey.onAfterRenderSurvey.add(function(survey) { // all subscriptions should be done before the render function call console.log("Hello world"); }); survey.render("surveyElement", { model: survey }); // at this point survey is alredy rendered, all subscriptions should be done before

Thanks Serge,
SurveyJS Team

    Comments (2)

      This solved the problem.Thank you team for your prompt reply.

        Fine! Feel free to contact us in case of any further questions