Skip to content
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