Flexmonster Software License Agreement (“Agreement”) has been significantly revised and is effective as of September 30, 2024.
The following modifications were made:
The modified version of Flexmonster Software License Agreement is available here.
Downloading, installing, and/or continuing to use Flexmonster Software after September 30, 2024, constitutes Licensee’s acceptance of the terms and conditions of the modified version of Flexmonster Software License Agreement. If Licensee does not agree to any of these terms and conditions, they must cease using Flexmonster Software and must not download, install, use, access, or continue to access Flexmonster Software. By continuing to use Flexmonster Software or renewing the license under License Model or Maintenance after the effective date of any modifications to Agreement, Licensee accepts and agrees to be bound by the terms and conditions of the modified Agreement.
save(params: Object)
Saves the current report to a specified location (e.g., to a server or to the local file system). The report is saved in JSON format.
Parameter/Type | Description |
---|---|
params Object | Contains parameters for saving the report. |
params.filename String | A default name of the file. |
params.destination String | optional Defines where to save the generated file. The destination can be either "server" (the file will be saved to the server) or "file" (the file will be saved to the local file system). When saving to a server, Flexmonster creates an XMLHttpRequest and sends it as a POST request.Default value: "file" . |
params.callbackHandler Function | optional A JS function that is called when the report is saved. It has the following parameters:
|
params.url String | optional A URL to the server-side script which saves the generated file. The file is sent as a POST parameter. Use this parameter only if the destination parameter is "server" . |
params.embedData Boolean | optional Specifies whether to save CSV data within the report or not. Default value: false . |
params.reportType String | optional The report can be saved in "json" or "xml" format. Starting from version 2.6.0, the "xml" format is deprecated. Default value: "json" . |
params.requestHeaders Object | optional Allows you to add custom request headers when saving the report to a server. This object consists of "key": "value" pairs, where "key" is a header’s name and "value" is its value. |
params.serverContentType String | optional When saving the report to a server, this parameter allows you to set the Content‑Type header for the POST request:
serverContentType to "application/json" is recommended since it allows saving large report files and simplifies parsing of the report on the server.Use this parameter only if the destination parameter is "server" .Default value: "application/x‑www‑form‑urlencoded" . |
params.withDefaults Boolean | optional Indicates whether the default values for options will be included in the report (true ) or not (false ). Default value: false . |
params.withGlobals Boolean | optional Indicates whether the options defined in the GlobalObject will be included in the report (true ) or not (false ). Default value: false . |
Property/Type | Description |
---|---|
report ReportObject | optional The saved report. This property is available only when saving the report was successful. |
message String | optional The error message. This property is available only when saving the report failed. |
response String | optional The server’s response. This property is defined only when the destination parameter is set to "server" . |
status Number | optional The response status code. This property is defined only when the destination parameter is set to "server" . |
1) How to save a report to the local file system:
pivot.save({
filename: 'myreport.json',
destination: 'file'
});
2) How to save a report to the server:
pivot.save({
filename: 'myreport.json',
destination: 'server',
url: 'https://yourserver.com/yourscript.php'
});
Note The server-side script should be created on your back end to save reports to the server. And the url
parameter is the path to this server-side script.
3) How to handle errors when saving to a server:
pivot.save(
{
filename: 'report.json',
destination: 'server',
url: 'https://httpstat.us/404',
serverContentType: 'application/json',
callbackHandler: function(result, error) {
if (error) {
alert("response: " + error.response + "\nstatus: "
+ error.status + "\nmessage: "+ error.message);
}
}
}
);
load
getReport
setReport
shareReport
Save and restore the report