Background CSV Export
Use ExportCsvWorkerPlugin to download large CSV files while the grid stays responsive. The plugin is part of @revolist/revogrid-pro.
import { ExportCsvWorkerPlugin } from '@revolist/revogrid-pro';
grid.plugins = [...grid.plugins, ExportCsvWorkerPlugin];
// After the grid is mounted, call this from your export button handler.async function downloadCsv() { const exporter = (await grid.getPlugins()).find( (plugin) => plugin instanceof ExportCsvWorkerPlugin, ); await exporter?.exportFile({ filename: 'orders' });}Use await exporter.exportBlob(options) to get the file for preview or upload. Both methods accept the Core CSV formatting options, including columnDelimiter, rowDelimiter, and bom. The beforeexport event can replace the export data or cancel it. When a listener cancels, exportBlob() returns null.
The export follows the grid’s visible row and column order, including pinned rows and columns. It excludes filtered or trimmed rows. With server-side data, it includes only the currently loaded rows. Export membership is captured at the start, and cell values are read in batches. Avoid editing exported cells during the export if you need the file to reflect a single point in time.
The packaged worker loads when the first export batch starts. If you copy the distribution files into your own site, serve the worker asset along with the JavaScript files and allow it in your Content Security Policy’s worker-src directive. If workers are unavailable or blocked, the plugin formats bounded batches on the main thread and yields between batches. Batches with complex cell values also use the main thread so objects retain their original serialization behavior.