Skip to content

Commit

Permalink
Merge pull request #8565 from surveyjs/bug/8433-patch-render-func
Browse files Browse the repository at this point in the history
Bug/8433-patch-render-func
  • Loading branch information
OlgaLarina authored Jul 16, 2024
2 parents 3d5939b + 74fe97c commit d79e73c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
3 changes: 2 additions & 1 deletion examples/survey-ui/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -976,7 +976,8 @@ function init() {
"result: " + JSON.stringify(result.data);
});

SurveyUI.renderSurvey(survey, document.getElementById("surveyElement"));
// SurveyUI.renderSurvey(survey, document.getElementById("surveyElement"));
survey.render(document.getElementById("surveyElement"));
}

if (!window["%hammerhead%"]) {
Expand Down
8 changes: 8 additions & 0 deletions src/entries/jquery-ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ function doPopupSurvey(props: any): void {
}

SurveyModel.platform = "jquery";
SurveyModel.prototype["render"] = function (element: any = null) {
if (this.renderCallback) {
this.renderCallback();
} else {
const survey = React.createElement(Survey, { model: this });
ReactDOM.render(survey, element);
}
};

export const preact: any = React;

Expand Down
7 changes: 7 additions & 0 deletions src/entries/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ if (!!jQuery) {
}

SurveyModel.platform = "ui";
SurveyModel.prototype["render"] = function (element: any = null) {
if (this.renderCallback) {
this.renderCallback();
} else {
renderSurvey(this, element);
}
};

export const preact: any = React;

Expand Down

0 comments on commit d79e73c

Please sign in to comment.