-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Steps to reproduce
Steps:
- DataGrid Args:
<div style={{maxHeight:'calc(100vh - 250px)',minHeight:'200px',display: "flex",flexDirection: "column"}}>
<DataGrid
apiRef={apiRef}
rowCount={rowCount}
dataSource={dataSource}
lazyLoadingRequestThrottleMs={1000}
lazyLoading
paginationModel={{ page: 0, pageSize: 10 }}
loading={pageState.loading}
showToolbar
rowHeight={rowHeight}
columns={columns}
listViewColumn={listViewColumn}
listView={isMobile}
getRowId={(row: modelItemSchemaType) => row.Id || 0}
sx={{
[`& .${gridClasses.columnHeader}:focus-within, & .${gridClasses.cell}:focus-within`]: {
outline: "none"
},
"--DataGrid-overlayHeight": "200px"
}}
initialState={{
pinnedColumns: {
left: ["Id", "ExchangeName"],
right: ["Time", "CreateTime"]
},
sorting: {
sortModel: [{ field: "CreateTime", sort: "desc" }]
}
}}
/>
</div>Current behavior
- My DataGrid is set to display only 10 rows per page. When I output
paramsindataSource.getRows, thepageSizevalue in it inexplicably becomes 100.
The first time the page loads, the output params parameters are as follows:
{
"groupKeys": [],
"paginationModel": {
"page": 0,
"pageSize": 100
},
"sortModel": [
{
"field": "CreateTime",
"sort": "desc"
}
],
"filterModel": {
"items": [],
"logicOperator": "and",
"quickFilterValues": [],
"quickFilterLogicOperator": "and"
},
"start": 0,
"end": 99,
"groupFields": [],
"aggregationModel": {}
}
In getRows, the program retrieves data from the server based on start and end, returning rows for the first 100 rows, and rowCount for 3931. At this point, the footer will display Total Rows: 3931.
2、When scrolling down to the 90th row again, the server is triggered again with the following parameters:
{
"groupKeys": [],
"paginationModel": {
"page": 0,
"pageSize": 100
},
"sortModel": [
{
"field": "CreateTime",
"sort": "desc"
}
],
"filterModel": {
"items": [],
"logicOperator": "and",
"quickFilterValues": [],
"quickFilterLogicOperator": "and"
},
"start": 100,
"end": 199,
"groupFields": [],
"aggregationModel": {}
}
The server will return rows 100-200 from the rows list, with a rowCount of 3931. At this point, the footer will display Total Rows: 200/3931.
- Once you scroll down to 200 items in the viewport area, you can no longer scroll down.
Expected behavior
The rowCount has already been set, and the returned value is 3931.
The viewport should continue scrolling if not all data has been loaded, so why does it stop loading data before reaching the 200th row?
Context
No response
Your environment
npx @mui/envinfo
Don't forget to mention which browser you used.
Output from `npx @mui/envinfo` goes here.
Search keywords: lazy-loading