Open
Description
Steps to reproduce
Link to live example: https://codesandbox.io/s/mystifying-neumann-jqrhw2?file=/src/Demo.tsx
Steps:
- Remove
initialState
prop. - Refresh the page and check for console logs
- Add back
initialState
prop - Refresh the page and check for console logs
Current behavior
The onFetchRows
function is triggered when the component initially loads if the initialState
prop includes a `sort´ configuration. This causes the data to be fetched client-side automatically, instead of following the expected behavior where the initial data is fetched server-side and subsequent data is fetched client-side via lazy loading.
Expected behavior
The onFetchRows
function should only be triggered when additional data is needed (scrolling down to load more rows). The initial data should only be fetched server-side.
Context
No response
Your environment
npx @mui/envinfo
System:
OS: Linux 6.6 Pop!_OS 22.04 LTS
Binaries:
Node: 21.7.1 - /run/user/1000/fnm_multishells/11297_1721987656477/bin/node
npm: 10.5.0 - /run/user/1000/fnm_multishells/11297_1721987656477/bin/npm
pnpm: 9.1.1 - /usr/local/bin/pnpm
Browsers:
Chrome: 122.0.6261.94
npmPackages:
@emotion/react: 11.11.4
@emotion/styled: 11.11.5
@mui/material: ^5.16.1 => 5.16.4
@mui/x-data-grid-premium: ^7.10.0 => 7.10.0
react: 18.3.1
Search keywords: initialState, onFetchRows, sorting
Order ID: 79663
Metadata
Metadata
Assignees
Labels
Something doesn't workThis is the name of the generic UI component, not the React module!Better integration with backends, e.g. data sourceRelated to the data grid Sorting featureGreat for first contributions. Enable to learn the contribution process.Support request from paid usersSupport request from a Premium standard plan user. https://mui.com/legal/technical-support-sla/