Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] Update lazy loading demo to show skeleton rows during initial rows fetch #12062

Merged
merged 2 commits into from
Feb 27, 2024

Conversation

cherniavskii
Copy link
Member

@cherniavskii cherniavskii commented Feb 14, 2024

@cherniavskii cherniavskii added docs Improvements or additions to the documentation component: data grid This is the name of the generic UI component, not the React module! v6.x feature: Row loading Related to the data grid Row loading features labels Feb 14, 2024
@mui-bot
Copy link

mui-bot commented Feb 14, 2024

Copy link
Member

@joserodolfofreitas joserodolfofreitas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we complement the docs too?

instead of:

To enable lazy loading, there are a few steps you need to follow:

First, set rowsLoadingMode="server". Then, set rowCount to reflect the number of available rows on the server. Third, set a callback function on onFetchRows to load the data corresponding to the row indices passed within GridFetchRowsParams. Finally, replace the empty rows with the newly fetched ones using apiRef.current.unstable_replaceRows() like in the demo below.

To enable lazy loading, there are a few steps you need to follow:

  • First, set rowsLoadingMode="server".
  • Then, set rowCount to reflect the number of available rows on the server. Start with a rowCount of zero to display skeleton rows as placeholders until the initial data is fully loaded.
  • Third, set a callback function on onFetchRows to load the data corresponding to the row indices passed within GridFetchRowsParams.
  • Finally, replace the empty rows with the newly fetched ones using apiRef.current.unstable_replaceRows() like in the demo below.

@joserodolfofreitas
Copy link
Member

Btw, I think we should remove the unstable_ prefix for v7 too.

Copy link
Member

@joserodolfofreitas joserodolfofreitas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌 Looks good, thanks!

@cherniavskii cherniavskii merged commit cc1f0ef into mui:master Feb 27, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: data grid This is the name of the generic UI component, not the React module! docs Improvements or additions to the documentation feature: Row loading Related to the data grid Row loading features v6.x
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants