Skip to content

Full-Width Rows

Pair getFullWidth with fullWidthRenderer to replace standard cell columns on matching rows with a custom full-width banner or summary panel.

Full-Width Summary Rows
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();
};
}
  • getFullWidth(params): Synchronous predicate receiving RealRowParams<T>.
  • fullWidthRenderer(params): Synchronous factory returning { element, update?, destroy() }.
  • fullWidthHeight: { estimatedHeight?: number, measureHeight?: boolean } (estimatedHeight defaults to rowHeight; measureHeight defaults to true, accepting up to 3 measurement corrections per causal epoch within 0.5 px tolerance).
  • Interaction Rules: Full-width rows support row selection, but contain no grid cells to edit, span, or include in cell ranges.