useSeizenTableEvent
useSeizenTableEvent<
TData,K>(table,event,callback):void
Defined in: packages/core/src/table/useSeizenTableEvent.ts:46
Hook to subscribe to SeizenTable events from application code.
This hook allows application code to subscribe to events emitted by the SeizenTable without needing to be inside a plugin context.
Type Parameters
Section titled “Type Parameters”TData
K extends keyof SeizenTableEventMap<unknown> | string & object
Parameters
Section titled “Parameters”SeizenTableInstance<TData>
The SeizenTable instance from useSeizenTable
K
The event name to subscribe to
callback
Section titled “callback”(payload) => void
The callback function to invoke when the event is emitted
Returns
Section titled “Returns”void
Example
Section titled “Example”function App() { const table = useSeizenTable({ data, columns });
// Subscribe to row-click events useSeizenTableEvent(table, "row-click", (row) => { console.log("Row clicked:", row); });
// Subscribe to selection changes useSeizenTableEvent(table, "selection-change", (selectedRows) => { console.log("Selection changed:", selectedRows); });
return <SeizenTable table={table} />;}