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][table] Make the data grid blend in #43489

Merged
merged 2 commits into from
Aug 28, 2024
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
15 changes: 7 additions & 8 deletions docs/data/material/components/table/DataTable.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as React from 'react';
import { DataGrid } from '@mui/x-data-grid';
import Paper from '@mui/material/Paper';

const columns = [
{ field: 'id', headerName: 'ID', width: 70 },
Expand Down Expand Up @@ -33,21 +34,19 @@ const rows = [
{ id: 9, lastName: 'Roxie', firstName: 'Harvey', age: 65 },
];

const paginationModel = { page: 0, pageSize: 5 };

export default function DataTable() {
return (
<div style={{ height: 400, width: '100%' }}>
<Paper sx={{ height: 400, width: '100%' }}>
<DataGrid
rows={rows}
columns={columns}
initialState={{
pagination: {
paginationModel: { page: 0, pageSize: 5 },
},
}}
initialState={{ pagination: { paginationModel } }}
pageSizeOptions={[5, 10]}
checkboxSelection
sx={{ overflow: 'clip' }}
sx={{ border: 0 }}
/>
</div>
</Paper>
);
}
15 changes: 7 additions & 8 deletions docs/data/material/components/table/DataTable.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as React from 'react';
import { DataGrid, GridColDef } from '@mui/x-data-grid';
import Paper from '@mui/material/Paper';

const columns: GridColDef[] = [
{ field: 'id', headerName: 'ID', width: 70 },
Expand Down Expand Up @@ -33,21 +34,19 @@ const rows = [
{ id: 9, lastName: 'Roxie', firstName: 'Harvey', age: 65 },
];

const paginationModel = { page: 0, pageSize: 5 };

export default function DataTable() {
return (
<div style={{ height: 400, width: '100%' }}>
<Paper sx={{ height: 400, width: '100%' }}>
<DataGrid
rows={rows}
columns={columns}
initialState={{
pagination: {
paginationModel: { page: 0, pageSize: 5 },
},
}}
initialState={{ pagination: { paginationModel } }}
pageSizeOptions={[5, 10]}
checkboxSelection
sx={{ overflow: 'clip' }}
sx={{ border: 0 }}
/>
</div>
</Paper>
);
}
22 changes: 10 additions & 12 deletions docs/data/material/components/table/DataTable.tsx.preview
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
<DataGrid
rows={rows}
columns={columns}
initialState={{
pagination: {
paginationModel: { page: 0, pageSize: 5 },
},
}}
pageSizeOptions={[5, 10]}
checkboxSelection
sx={{ overflow: 'clip' }}
/>
<Paper sx={{ height: 400, width: '100%' }}>
<DataGrid
rows={rows}
columns={columns}
initialState={{ pagination: { paginationModel } }}
pageSizeOptions={[5, 10]}
checkboxSelection
sx={{ border: 0 }}
/>
</Paper>
2 changes: 1 addition & 1 deletion docs/data/material/components/table/table.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ This constraint makes building rich data tables challenging.
The [`DataGrid` component](/x/react-data-grid/) is designed for use-cases that are focused on handling large amounts of tabular data.
While it comes with a more rigid structure, in exchange, you gain more powerful features.

{{"demo": "DataTable.js", "bg": "outlined"}}
{{"demo": "DataTable.js", "bg": true}}

## Dense table

Expand Down