Skip to content

Commit

Permalink
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/survey.ts
Original file line number Diff line number Diff line change
@@ -2902,7 +2902,20 @@ export class SurveyModel extends SurveyElementCore
this.updateAllQuestionsValue(clearData);
}
public get isSurvey(): boolean { return true; }
public getData(options?: { includePages?: boolean, includePanels?: boolean}): any {
/**
* Returns an object with survey results.
*
* If you want to get a survey results object that mirrors the survey structure, call the `getData()` method with an object that has the `includePages` and `includePanels` properties enabled. Without this object, the `getData()` method returns the [`data`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#data) property value.
*
* ```js
* import { Model } from "survey-core";
*
* const surveyJson = { ... };
* const survey = new Model(surveyJson);
* survey.getData({ includePages: true, includePanels: true });
* ```
*/
public getData(options?: { includePages?: boolean, includePanels?: boolean }): any {
const opt = options || { includePages: false, includePanels: false };
if(!opt.includePages && !opt.includePanels) return this.data;
return this.getStructuredData(!!opt.includePages, !opt.includePanels ? (opt.includePages ? 1 : 0) : -1);

0 comments on commit 6fb05ad

Please sign in to comment.