Export utils
copyToClipboard, exportToCSV, exportToCSVGrouped, exportToCSVServerGrouped and 13 more: generated from the source of active-grid.
Exported by @workspace/. Generated from the package source; part of the index of every export.
Functions, hooks and constants#
Copy rows to the clipboard as TSV.
The clipboard copy is deliberately PRESENTATION output: whoever copies, copies what they see -- formatted dates, amounts with their symbol, translated badge labels. This is NOT a machine export contract; whoever needs data uses the CSV/XLSX/JSON export in the default DATA mode.
<TData>(publicRows: readonly Row<TData>[], publicGrid: Grid<TData>, options: GridClipboardOptions) => Promise<boolean><TData>(publicRows: readonly Row<TData>[], publicGrid: Grid<TData>, filename: string, options?: GridExportRunOptions, csvDelimiter?: CsvDelimiter) => voidExport to CSV with group structure. Group headers and footers are rendered as distinct rows.
<TData>(publicGrid: Grid<TData>, filename: string, scope: "all" | "filtered", options?: GridExportRunOptions, csvDelimiter?: CsvDelimiter) => voidExport server-side grouped data to CSV. Traverses the group tree by calling fetchFn for each group level.
<TData>(publicGrid: Grid<TData>, config: ServerGroupedExportConfig<TData>, filename: string, options?: GridExportRunOptions, csvDelimiter?: CsvDelimiter) => Promise<void><TData>(publicRows: readonly Row<TData>[], publicGrid: Grid<TData>, filename: string, options?: GridExcelExportOptions) => Promise<void>Export to Excel with group structure. Group headers occupy the first cell of their row, footers show aggregated values.
<TData>(publicGrid: Grid<TData>, filename: string, scope: "all" | "filtered", options?: GridExcelExportOptions) => Promise<void>Export server-side grouped data to Excel.
<TData>(publicGrid: Grid<TData>, config: ServerGroupedExportConfig<TData>, filename: string, options?: GridExcelExportOptions) => Promise<void><TData>(publicRows: readonly Row<TData>[], publicGrid: Grid<TData>, filename: string, options?: GridExportRunOptions) => voidExport to JSON with hierarchical group structure.
<TData>(publicGrid: Grid<TData>, filename: string, scope: "all" | "filtered", options?: GridExportRunOptions) => voidExport server-side grouped data to JSON with hierarchical structure.
<TData>(publicGrid: Grid<TData>, config: ServerGroupedExportConfig<TData>, filename: string, options?: GridExportRunOptions) => Promise<void>Export rows to PDF as a formatted table. Uses jsPDF + jspdf-autotable, optional dependencies loaded on first use.
PDF is presentation output by definition: it renders the same human-readable form as the grid, so it takes the viewer's locale. Rejects with a Grid for text it cannot draw; no file is produced then.
<TData>(publicRows: readonly Row<TData>[], publicGrid: Grid<TData>, filename: string, options: GridPdfExportOptions) => Promise<void>Export to PDF with group structure. Group headers are rendered as spanning rows, group footers show aggregated values in bold.
<TData>(publicGrid: Grid<TData>, filename: string, scope: "all" | "filtered", options: GridPdfExportOptions) => Promise<void>Export server-side grouped data to PDF.
<TData>(publicGrid: Grid<TData>, config: ServerGroupedExportConfig<TData>, filename: string, options: GridPdfExportOptions) => Promise<void>Types#
Options for the clipboard copy. Presentation output, so with a locale.
interface GridClipboardOptions {
locale: GridPresentation;
includeHeaders?: boolean;
diagnostics?: GridDiagnosticSink;
}The options of an XLSX export: the data-mode options every data format shares, plus the sheet's direction. There is deliberately no font: SheetJS Community Edition writes no styles, and a workbook's look belongs to the spreadsheet application.
type GridExcelExportOptions = GridExportRunOptions & {
direction?: GridExportDirection;
};PDF is HUMAN output: always presentation, so always with a locale. The other two fields are the explicit call's; the row menu fills them from the grid.
interface GridPdfExportOptions {
locale: GridPresentation;
fonts?: GridExportFonts | 'inherit';
direction?: GridExportDirection;
}Configuration for server-side grouped export.
interface ServerGroupedExportConfig<TData> {
fetchFn: ServerFetchFunction<TData>;
groupBy: GroupByColumn[];
groupAggregations?: GroupAggregation[];
sorting?: SortingState;
filters?: ColumnFiltersState;
globalFilter?: string;
onProgress?: (loaded: number, total: number) => void;
}