Skip to content

useGrid

Hook for programmatic access to a grid instance.

import { DataGrid, useGrid } from '@toolbox-web/grid-react';
function MyComponent() {
const { ref, isReady, getConfig, forceLayout } = useGrid<Employee>();
const handleResize = async () => {
await forceLayout();
};
const handleExport = async () => {
const config = await getConfig();
console.log('Exporting with columns:', config?.columns);
};
return (
<>
<button onClick={handleResize}>Force Layout</button>
<button onClick={handleExport} disabled={!isReady}>Export</button>
<DataGrid ref={ref} rows={rows} />
</>
);
}
useGrid(): UseGridReturn<TRow>
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