Complete filtered remote exports
Select Open orders only, then export the matching rows. The grid shows two orders per page. The CSV also contains the matching order on page two.
Connect an export endpoint
Section titled “Connect an export endpoint”Register RemoteGridExportPlugin alongside remote pagination, infinite scrolling or server-side grouping. The plugin captures the active query and visible columns at the start of the export. It sends neither the current page nor a viewport row limit.
import { RemoteGridExportPlugin, defineRemoteGridExportControls,} from '@revolist/revogrid-pro';
grid.plugins = [...grid.plugins, RemoteGridExportPlugin];grid.remoteGridExport = { async exportRows(request, { signal }) { const response = await fetch('/api/orders/export', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(request), signal, }); if (!response.ok) throw new Error('Could not export orders'); return response.blob(); },};
await grid.componentOnReady();const exporter = (await grid.getPlugins()).find( (plugin): plugin is RemoteGridExportPlugin => plugin instanceof RemoteGridExportPlugin,);
if (exporter) { const unmount = defineRemoteGridExportControls(toolbar, grid, exporter, { format: 'xlsx', columns: ['item', 'status', 'amount'], filename: 'orders', }); // Keep unmount for toolbar disposal.}The host callback authorizes the request, applies the query, and generates the file. The query includes the filters and sort from the active row loader. It also includes grouping and aggregate descriptors when server-side grouping owns the source. The request lists the chosen columns in grid order. Specify only visible columns when passing a subset.
For background reports, start the job and poll its status inside the callback. Call reportProgress(fraction) to report progress from zero to one. Use the supplied abort signal for each request. The toolbar shows progress and lets the user cancel. A cancelled client will discard late results. Stopping the server job itself depends on your backend’s cancellation support.
Use getRequest(), exportFile(), cancel(), and getState() to build application controls. Subscribe to remotegridexportstatechange for status updates. Pass localized labels to the toolbar as the fifth argument.