Exporting data
Pivot exports table data in XLSX or CSV format through the underlying Table widget. Access the Table instance with the getTable method, then trigger the export event with the Table's api.exec method.
The example below accesses the Table instance and triggers the export event in CSV and XLSX formats:
const widget = new pivot.Pivot("#root", { /* settings */ });
widget.getTable().exec("export", {
options: {
format: "csv",
cols: ";"
}
});
widget.getTable().exec("export", {
options: {
format: "xlsx",
fileName: "My Report",
sheetName: "Quarter 1"
}
});
tip
The getTable method accepts an optional wait boolean parameter. Pass true to receive a promise that resolves once the Table API is available. Useful when the Table API must be ready during Pivot initialization.
Example
The snippet below exports data:
Related articles: