Full-Width Rows
Pair getFullWidth with fullWidthRenderer to replace standard cell columns on matching rows with a custom full-width banner or summary panel.
import { Grid, type ColumnDef } from 'next-grid-js';import { createOrders, type OrderRow } from './data/orders';import { syncGridTheme } from './theme';import type { DemoMountContext } from './types';
export function mount({ stage }: DemoMountContext): () => void { const columnDefs: readonly ColumnDef<OrderRow>[] = [ { key: 'id', name: 'ID', width: 96, }, { key: 'customer', name: 'Customer', width: 175, flex: 1, }, { key: 'region', name: 'Region', width: 105, }, { key: 'amount', name: 'Amount', width: 115, cellDataType: 'number', formatter: ({ value }) => `$${Number(value).toLocaleString('en-US')}`, }, ];
const grid = new Grid<OrderRow>({ container: stage, columnDefs, rowData: createOrders(25), getRowId: (row) => row.id, getFullWidth: ({ sourceIndex }) => sourceIndex % 5 === 0, fullWidthHeight: { estimatedHeight: 40, measureHeight: false, }, fullWidthRenderer: ({ data, document: doc }) => { const banner = doc.createElement('div'); Object.assign(banner.style, { display: 'flex', alignItems: 'center', justifyContent: 'space-between', padding: '0 12px', height: '39px', boxSizing: 'border-box', fontWeight: '600', background: 'rgba(34, 197, 94, 0.08)', }); const title = doc.createElement('span'); const total = doc.createElement('span'); const apply = (row: OrderRow) => { title.textContent = `Summary Banner · ${row.id} (${row.customer})`; total.textContent = `$${row.amount.toLocaleString('en-US')}`; }; banner.append(title, total); apply(data); return { element: banner, update: ({ data: next }) => apply(next), destroy: () => banner.remove(), }; }, }); const stopTheme = syncGridTheme(stage);
return () => { grid.destroy(); stopTheme(); };}Configuration & Behavior
Section titled “Configuration & Behavior”getFullWidth(params): Synchronous predicate receivingRealRowParams<T>.fullWidthRenderer(params): Synchronous factory returning{ element, update?, destroy() }.fullWidthHeight:{ estimatedHeight?: number, measureHeight?: boolean }(estimatedHeightdefaults torowHeight;measureHeightdefaults totrue, accepting up to3measurement corrections per causal epoch within0.5 pxtolerance).- Interaction Rules: Full-width rows support row selection, but contain no grid cells to edit, span, or include in cell ranges.