I am using ag-grid-react
v 32 and want to replace my deprecated showLoadingOverlay
with another method to show/hide the loading overlay. I’ve tried both ways suggested by Ag Grid (the loading
prop and the setGridOption("loading", true)
), however both don’t work.
The loading={true}
has no effect and when I try to call setGridOption("loading", true)
I get setGridOption
is undefined 🙁
How can I control the loading overlay in ag-grid-react
v 32? Am I missing something?
useEffect(() => {
if (loading) {
setTimeout(() => gridRef.current?.api?.setGridOption("loading", true), 0);
} else {
if (!gridData.length) {
setTimeout(() => gridRef.current?.api?.showNoRowsOverlay(), 0);
} else setTimeout(() => gridRef.current?.api?.hideOverlay(), 0);
}
}, [loading]);
return (
<AgGridReact
ref={gridRef}
gridOptions={gridOptions}
rowData={gridData}
columnDefs={customColumnDef}
loading={loading}
/>
);