Skip to content

Commit

Permalink
[docs][table] Make the data grid blend in (#43489)
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Aug 28, 2024
1 parent 20fa6b9 commit f859062
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 29 deletions.
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

0 comments on commit f859062

Please sign in to comment.