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

[core] Fix typo #5990

Merged
merged 2 commits into from
Sep 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion docs/data/data-grid/row-updates/row-updates.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,18 @@ 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.replaceRows()` like in the demo below.
Finally, replace the empty rows with the newly fetched ones using `apiRef.current.unstable_replaceRows()` like in the demo below.

{{"demo": "LazyLoadingGrid.js", "bg": "inline", "disableAd": true}}

:::warning
The `onFetchRows` callback is called every time a new row is in the viewport, so when you scroll, you can easily send multiple requests to your backend. We recommend developers limit those by implementing debouncing.
:::

:::warning
For now, lazy loading rows does not work with row grouping or tree data.
:::

:::info
In order for filtering and sorting to work you need to set their modes to `server`.
You can find out more information about how to do that on the [server-side filter page](/x/react-data-grid/filtering/#server-side-filter) and on the [server-side sorting page](/x/react-data-grid/sorting/#server-side-sorting).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ function findSkeletonRowsSection(
function isLazyLoadingDisabled({
lazyLoadingFeatureFlag,
rowsLoadingMode,
gridDimentions,
gridDimensions,
}: {
lazyLoadingFeatureFlag: boolean;
rowsLoadingMode: GridFeatureMode;
gridDimentions: GridDimensions | null;
gridDimensions: GridDimensions | null;
}) {
if (!lazyLoadingFeatureFlag || !gridDimentions) {
if (!lazyLoadingFeatureFlag || !gridDimensions) {
return true;
}

Expand Down Expand Up @@ -128,7 +128,7 @@ export const useGridLazyLoader = (
isLazyLoadingDisabled({
lazyLoadingFeatureFlag: lazyLoading,
rowsLoadingMode: props.rowsLoadingMode,
gridDimentions: dimensions,
gridDimensions: dimensions,
})
) {
return;
Expand Down Expand Up @@ -176,7 +176,7 @@ export const useGridLazyLoader = (
isLazyLoadingDisabled({
lazyLoadingFeatureFlag: lazyLoading,
rowsLoadingMode: props.rowsLoadingMode,
gridDimentions: dimensions,
gridDimensions: dimensions,
})
) {
return;
Expand Down Expand Up @@ -205,7 +205,7 @@ export const useGridLazyLoader = (
isLazyLoadingDisabled({
lazyLoadingFeatureFlag: lazyLoading,
rowsLoadingMode: props.rowsLoadingMode,
gridDimentions: dimensions,
gridDimensions: dimensions,
})
) {
return;
Expand Down