useGridAIRequest
Hook
A custom hook that encapsulates the AI request logic for the Grid. This hook can be used by both GridToolbarAIAssistant and SmartBox components.
Definition
Package:@progress/kendo-react-grid
Syntax:
tsx
const { loading, streaming, sendRequest, cancelRequest } = useGridAIRequest({
requestUrl: '/api/ai/grid',
columns: gridColumns,
gridState: currentState,
gridRef: gridRef.current,
onStateChange: (newState) => setGridState(newState),
onMessages: (messages) => console.log(messages)
});
// Send a request
sendRequest('Sort by price descending');
// Cancel if needed
cancelRequest();