Survey-library: customize survey panel

Created on 25 Mar 2019  路  6Comments  路  Source: surveyjs/survey-library

referencing #1043,
I've upgraded survey-react, and now my special panels are not working.
Surely i can overwrite row createElement, but IMHO permit to override the default panel renderer by exposing ReactElementFactory as https://github.com/surveyjs/surveyjs/issues/1274#issuecomment-412545414 suggest will be a better long term solution.

Am I Right?

Thanks in advance
Marco

question

All 6 comments

@marc0n3 Could you share your code? We have added a flow panel several weeks ago (it is still not finish completely, but you may make it visible on Editor Toolbar). Probably this is the reason.

Thank you,
Andrew

It was like this, for the old version:
SurveyRow.prototype.createQuestion =function(question){

    if (question.isPanel) {
        return (
                <SurveyPanelExtension
                        key={question.name}
                        panel={question}
                        creator={this.creator}
                        survey={this.survey}
                        css={this.css}
                />
        );
    } else {
        return (
                <SurveyQuestion
                        key={question.name}
                        question={question}
                        creator={this.creator}
                        css={this.css}
                />
        );
    }
}

see bug #1043, for our previous talk

@marc0n3 Please use the following code:

ReactElementFactory.Instance.registerElement("panel", props => {
  return React.createElement(SurveyPanelExtension, props);
});

Thank you,
Andrew

I've exported the ReactElementFactory

@marc0n3 You should to wait till the next build. ReactElementFactory was an internal class. @tsv2013 just added it into export classes file. We will release a new version in couple days.

Thank you,
Andrew

Thank you @andrewtelnov and @tsv2013

Was this page helpful?
0 / 5 - 0 ratings