Even when I explicitly set the paginationMeta.hasNextPage prop to false:
return (
<DataGrid rows={rows} columns={rfqCols}
paginationModel={paginationModel}
paginationMeta={{hasNextPage: false}}
sortingMode="server"
paginationMode="server"
onPaginationModelChange={handlePaginationModelChange}
onSortModelChange={handleSortModelChange}
rowCount={-1}
pageSizeOptions={[1,3,5]}
/>
);
The "next page" button stays active:
What am I missing? How can I control whether or not the "next page" button is active or disabled?
Ok, instead of setting the rowCount
prop every render, I needed to set the initalState.pagination.rowCount
prop to initialize the rowCount to -1, then everything worked as expected:
return (
<DataGrid rows={rows} columns={rfqCols}
initialState={{ pagination: { rowCount: -1}}}
paginationModel={paginationModel}
paginationMeta={paginationMeta}
sortingMode="server"
paginationMode="server"
onPaginationModelChange={handlePaginationModelChange}
onPaginationMetaChange={(newMeta) => console.log('newMeta:', newMeta)}
onSortModelChange={handleSortModelChange}
pageSizeOptions={[1,3,5]}
/>
);