Export Data from your Data Grid to file
With our data grid you can export your data to file.
There are two ways to export data:
Export to CSV file
To export data to CSV file you need to use exporting option.
- Setup
exportingoption onrevo-gridtotrue:
tsx
<revo-grid exporting="true"/>- Access export plugin from plugin list:
js
const grid = document.querySelector('revo-grid');
grid.getPlugins().then(plugins => {
plugins.forEach(p => {
if (p.exportFile) {
const exportPlugin = p;
exportPlugin.exportFile({ filename: 'new file' });
}
})
});Public methods
There are next methods available in export plugin and options object as FormatterOptions:
exportFile(options)- download file;exportBlob(options)- export Blob object;exportString(options)- get data string.
Options
General options are available for export:
ts
type FormatterOptions = {
mime: string; // text/csv
encoding: string;
fileKind: string; // csv
bom: boolean;
columnDelimiter: string; // ','
rowDelimiter: string; // '\r\n'
filename?: string;
}TIP
For the latest information it's recommended to read export-plugin file for better understanding of parameters and options.