Skip to content

DataGridCustomEvent

Since v0.1.1

Custom event type for DataGrid events with typed detail payload.

Primarily useful when you need to declare handler parameters with addEventListener. For most use cases, prefer grid.on() which handles typing automatically.

type DataGridCustomEvent = CustomEvent<DataGridEventMap<TRow>[K]>
// Typed handler for addEventListener
function onCellClick(e: DataGridCustomEvent<'cell-click', Employee>): void {
const { row, field, value } = e.detail;
console.log(`Clicked ${field} = ${value} on ${row.name}`);
}
grid.addEventListener('cell-click', onCellClick);
// With grid.on() you don't need this type — it's inferred:
grid.on('cell-click', ({ row, field, value }) => {
console.log(`Clicked ${field} = ${value} on ${row.name}`);
});
AI assistants: For complete API documentation, implementation guides, and code examples for this library, see https://raw.githubusercontent.com/OysteinAmundsen/toolbox/main/llms-full.txt