Issue T7996
Visible to All Users

Custom Widget > afterRender function > HTML element argument

created 3 years ago

Hi, I would like to ask what should be received in the HTML element argument of the afterRender function of custom widgets. I've seen different behaviors depending on where the question is placed. I expected it to be the root of the htmlTemplate property. Simple questions are working as I expected. But for questions inside matrix, it is returning the table data tag (TD). Please, take a look at the example below:

https://plnkr.co/edit/XxGxeD2VPuM4e4vr

Best regards,
Vitor.

Answers approved by surveyjs Support

created 3 years ago

Hello Vitor,
Element is a root element. It could be div or in case of table a td element.
We do not make another div inside the td, since it doesn't make a lot of sense.
You should not modify element, you need to modify elements and inner html inside the element.

Thank you,
Andrew
SurveyJS Team

    Show previous comments (1)

      Just realized now that this issue may cause problems on your own custom widgets library. I just updated the Punkler code with the emotionsratings widget. At first, everything looks good. But, this widget replaces the entire content of the HTML element passed as argument to the afterRender. That means it erased the div responsible for showing errors. Try to complete the survey, and you will see that it doesn't show the error message.

      https://plnkr.co/edit/XxGxeD2VPuM4e4vr

        Hello Vitor,
        Indeed. We will take a look.

        Thank you,
        Andrew
        SurveyJS Team

          I have fixed this issue in v1.8.73. Here is the related issue on GitHub.

          Thank you,
          Andrew
          SurveyJS Team