Question T1976
Visible to All Users

cannot restore partial survey in survey react.

created 6 years ago

Given the following how can the data be restored to the Survey Widget. I cannot restore it.

The get data function below returns data that was saved with–
survey.getPlainData({
calculations: [{ propertyName: "conceptCode" }]
});
render(){
Survey.Survey.cssType = "bootstrap";
Survey.defaultBootstrapCss.navigationButton = "btn btn-green";
Survey
.JsonObject
.metaData
.addProperty("question", {
name: "conceptCode:string",
default: "",
choices: this.choices
});

return(
<div id="surveyContainer">
<Survey.Survey
json={this.propJSON}
onComplete={this.onSurveyComplete}
onPartialSend={this.onSurveyPartialSend}
sendResultOnPageNext={true}
data={this.getData()}
currentPageNo={this.props.formOrderItems[0].current_page + 1} />
</div>

By the was I cannot use
var model = new Survey.Model(this.propJSON)
because then I cannot add the conceptCode property to the survey for some reason

Thanks,
Jim

Answers approved by surveyjs Support

created 6 years ago

Hello Jim,
If you call adding property before creating the model, then you should be fine.

And it works in my example.

Thank you,
Andrew
SurveyJS Team