Grid API
Use the API methods to query grid state and run operations programmatically.
Warning
Avoid calling API methods in the render path of a React component. To prevent state issues, use API methods in callbacks or effects unless you have an advanced understanding of the grid’s state flow.
Getting the API
LyteNyte Grid provides the API as a prop to all renderers and event callbacks
exposed by the grid. If you need to use the API in other parts of your application,
provide the grid with a ref prop to access the API directly.
const apiRef = useRef();
return <Grid ref={apiRef} />;Extending the API
You can extend the LyteNyte Grid API with custom properties to add new capabilities and simplify integration of the grid into your application. The code below shows a basic example. See the API Extension guide for more details.
interface GridSpec { readonly api: { notify: () => void };}
type MyExtendedAPI = Grid.API<GridSpec>=
function MyGrid() { const apiExtension = useMemo(() => { return { notify: () => { // Do something } } }, [])
return <Grid apiExtension={apiExtension} />}Grid API Properties
The properties listed below are grouped into sections, but they are all available on the same API instance.
Note
LyteNyte Grid’s API is further extended by the row source provided to the grid. In addition to the properties listed below, the row source properties are also available on the API instance. See the Row Source reference for more details.
Grid
Prop
Columns
Prop
Rows
Prop
Cell Editing
Prop
