-
Notifications
You must be signed in to change notification settings - Fork 0
Upgrading 1.2 to 1.3
📝 Generated from
docs/upgrade-guide-1.2.1-to-1.3.0.md. Edit it there; changes made in the wiki are overwritten.
Package: @opencorestack/opengridx
This guide covers: 1.2.1 → 1.3.0 (historical reference — current version is 2.0.2; see docs/migration/v1-to-v2.md for the v2 upgrade)
None. Every change in this guide is additive or a behavioral fix with an opt-out.
npm install @opencorestack/opengridx@1.3.0
# if using PDF export:
npm install jspdf jspdf-autotableNew exportToPdf function. Requires optional peer deps jspdf + jspdf-autotable — install only if you use PDF export. The main bundle is unaffected (lazy-loaded).
import { exportToPdf } from '@opencorestack/opengridx';
await exportToPdf(rows, columns, {
fileName: 'report',
title: 'My Report',
orientation: 'landscape', // 'portrait' | 'landscape'
aggregationResult, // pass your aggregation totals
aggregationModel,
filterModel,
selectedRows, // export only selected row ids
headerBackgroundColor: '#4f46e5',
headerTextColor: '#ffffff',
alternateRowColor: true,
fontSize: 9,
});getAllFilteredRows() returns all filtered+sorted rows regardless of the current pagination window. Use it for full-dataset exports without changing pageSize.
const allRows = apiRef.current.getAllFilteredRows();
exportToCsv(allRows, columns, { fileName: 'full.csv' });renderCell errors are now correctly caught per-cell — the grid keeps rendering the other cells. Previously the throw could escape the boundary in certain React render paths.
Behavioral change — no code change required.
Columns with hideable: false no longer appear as disabled rows in the GridToolbar Columns panel. They still render normally in the grid body and in all exports.
To restore the previous behavior (show them as permanently-disabled rows):
<DataGrid
slots={{ toolbar: GridToolbar }}
slotProps={{ toolbar: { showNonHideableColumns: true } }}
...
/>When row grouping is active, you can export the grouped structure instead of a flat row list. All five export functions (exportToCsv, exportToExcel, exportToJson, printGrid, exportToPdf) support it via a new optional groupedRows parameter.
When groupedRows is absent the output is identical to the previous flat format — no migration needed for existing export calls.
Step 1 — retrieve the grouped row list from the API:
const groupedRows = apiRef.current.getGroupedExportRows();
// GridGroupedExportRow[] | null
// null when rowGroupingModel is not activeStep 2 — pass it to any export function:
exportToCsv(rows, columns, {
fileName: 'grouped.csv',
groupedRows: groupedRows ?? undefined,
aggregationModel: { salary: 'sum' },
});
exportToExcel(rows, columns, {
fileName: 'grouped.xls',
groupedRows: groupedRows ?? undefined,
});
exportToJson(rows, columns, {
fileName: 'grouped.json',
groupedRows: groupedRows ?? undefined,
});
printGrid(rows, columns, {
groupedRows: groupedRows ?? undefined,
});
await exportToPdf(rows, columns, {
fileName: 'grouped',
groupedRows: groupedRows ?? undefined,
});| Format | Grouped output |
|---|---|
| CSV | Group header row → indented leaf rows → Subtotal row → Grand Total row |
| Excel | Shaded group-header rows → indented leaf rows → bold subtotal / grand-total rows |
| JSON | { groups: [{ group, rows, subtotals?, children? }], grandTotal? } |
CSS-classed .group-header / .group-subtotal / .grand-total rows with indentation |
|
| Indented body rows + bold footer for grand total |
interface GridGroupedExportRow {
type: 'group-header' | 'leaf' | 'group-subtotal' | 'grand-total';
depth: number;
groupField?: string;
groupValue?: unknown;
aggregatedValues?: Record<string, unknown>;
row?: GridRowModel;
}getGroupedExportRows(): GridGroupedExportRow[] | null;Returns a flat ordered list that preserves the grouping tree structure:
group-header → leaf rows → group-subtotal (repeated per group, nested for multi-level grouping) followed by a grand-total entry when aggregation is active. Returns null when rowGroupingModel is not set.
OpenGridX 3.2.2 · MIT · This wiki is generated from docs/ on every push to main. To fix a page, open a PR against the source file.
Start here
Components
- DataGrid
- Header
- Row
- Cell
- Toolbar
- Pagination
- Filter Panel
- Tooltip
- Column Visibility
- Column Grouping
- Column Resizing
- Empty State
- Error Overlay
- Aggregation Footer
Features
- Virtualization
- Filtering & Search
- Sorting & Pagination
- Custom Pagination
- Editing & Reordering
- Row Selection
- Clipboard
- Pinning
- State Persistence
- Aggregation & Pivot
- Tree Data & Grouping
- Cell Spanning
- Master-Detail
- Keyboard & Accessibility
- List View
- Infinite Scroll
- Data Source
- Loading States
- Toolbar Customization
- Export (CSV, Excel, JSON, Print)
- PDF Export
Customization
Upgrading
Contributing
- Contributing
- Testing
- Roadmap
- DataGrid orchestration
- GridRowMeta
- useGridControlledState
- useGridRowPipeline
- useGridColumns
- useGridVirtualization
- useGridVisibleRows
- useGridScrollSync
- useGridStateSnapshot