Skip to content

Commit

Permalink
Update demo
Browse files Browse the repository at this point in the history
  • Loading branch information
arminmeh committed Aug 8, 2024
1 parent deae493 commit 3d0de1a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
12 changes: 9 additions & 3 deletions docs/data/data-grid/server-side-data/ServerSideLazyLoading.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import * as React from 'react';
import { DataGridPro } from '@mui/x-data-grid-pro';
import { DataGridPro, GridToolbar } from '@mui/x-data-grid-pro';
import { useMockServer } from '@mui/x-data-grid-generator';

function ServerSideLazyLoading() {
const { columns, fetchRows } = useMockServer(
{},
{ rowLength: 120 },
{ useCursorPagination: false, minDelay: 300, maxDelay: 800 },
);

Expand Down Expand Up @@ -32,7 +32,13 @@ function ServerSideLazyLoading() {

return (
<div style={{ width: '100%', height: 400 }}>
<DataGridPro columns={columns} unstable_dataSource={dataSource} lazyLoading />
<DataGridPro
columns={columns}
unstable_dataSource={dataSource}
slots={{ toolbar: GridToolbar }}
lazyLoading
paginationModel={{ page: 0, pageSize: 12 }}
/>
</div>
);
}
Expand Down
11 changes: 9 additions & 2 deletions docs/data/data-grid/server-side-data/ServerSideLazyLoading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ import {
DataGridPro,
GridDataSource,
GridGetRowsParams,
GridToolbar,
} from '@mui/x-data-grid-pro';
import { useMockServer } from '@mui/x-data-grid-generator';

function ServerSideLazyLoading() {
const { columns, fetchRows } = useMockServer(
{},
{ rowLength: 120 },
{ useCursorPagination: false, minDelay: 300, maxDelay: 800 },
);

Expand Down Expand Up @@ -36,7 +37,13 @@ function ServerSideLazyLoading() {

return (
<div style={{ width: '100%', height: 400 }}>
<DataGridPro columns={columns} unstable_dataSource={dataSource} lazyLoading />
<DataGridPro
columns={columns}
unstable_dataSource={dataSource}
slots={{ toolbar: GridToolbar }}
lazyLoading
paginationModel={{ page: 0, pageSize: 12 }}
/>
</div>
);
}
Expand Down

0 comments on commit 3d0de1a

Please sign in to comment.