getReport(options: Object): ReportObject
Returns a ReportObject that describes the current report. Use this object to save or edit the report at runtime.
Parameter/Type | Description |
---|---|
options Object | optional Specifies which options should be included in the report. |
options.withDefaults Boolean | optional Specifies whether the options with default values will be included in the report (true ) or not (false ).Learn more about saving the report with default values. Default value: false . |
options.withGlobals Boolean | optional Specifies whether the global configs defined in the GlobalObject will be included in the report (true ) or not (false ).Learn more about saving the report with global configs. Default value: false . |
1) Get the report:
const pivot = new Flexmonster({
container: "pivot-container",
report: {
dataSource: {
filename: "https://cdn.flexmonster.com/data/data.json"
}
}
});
let report = pivot.getReport();
2) Swap two reports:
const pivot1 = new Flexmonster({
container: "firstPivotContainer",
report: {
dataSource: {
filename: "https://cdn.flexmonster.com/data/data.csv"
}
}
});
const pivot2 = new Flexmonster({
container: "secondPivotContainer",
report: {
dataSource: {
filename: "https://cdn.flexmonster.com/data/data-fr.csv"
}
}
});
function swapReports() {
const report1 = pivot1.getReport();
const report2 = pivot2.getReport();
pivot1.setReport(report2);
pivot2.setReport(report1);
}
3) Get a report with default and global configurations:
const pivot = new Flexmonster({
container: "pivot-container",
global: {
options: {
defaultHierarchySortName: "desc",
readOnly: true
}
},
report: {
dataSource: {
filename: "https://cdn.flexmonster.com/data/data.json"
},
options: {
grid: {
showGrandTotals: "rows"
},
readOnly: false
}
}
});
let report = pivot.getReport({
withGlobals: true,
withDefaults: true
});