Get Free Trial
API reference
Table of contents

shareReport

shareReport(options: Object): Promise<String>

[starting from version 2.9]

Saves the current report to Flexmonster Data Server and provides a link to the saved report.

To save a report, Flexmonster creates an XMLHttpRequest and sends it to the Data Server as a POST request. The request is sent to <url>/save, where url is the Data Server’s URL (e.g., http://localhost:9500).

For more details on report sharing, see this guide: Share the report.

Parameters

  • options optionalShareReportConnectionObject. Contains the configuration needed to save the shared report. This parameter is optional if the Data Server is used as a data source on the page. Otherwise, it is needed to define options.

Returns

Returns a Promise object that resolves to a string, which is a link to the saved report.

Examples

1) Share a report with JSON as a data source:

new Flexmonster({
container: "pivot-container",
report: {
dataSource: {
filename: "data.json"
}
},
shareReportConnection: {
url: "http://localhost:9500"
}
});

flexmonster.shareReport();

2) Share a report with Flexmonster Data Server as a data source:

new Flexmonster({
container: "pivot-container",
report: {
dataSource: {
type: "api",
url: "http://localhost:9500",
index: "fm-product-sales"
}
}
});

flexmonster.shareReport();

See also

Share the report
setReport
getReport
open
load
save