Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[docs] Add live demo with DataGrid (#22697)
- Loading branch information
1 parent
e3ce069
commit 2ebc2c0
Showing
10 changed files
with
113 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import * as React from 'react'; | ||
import { DataGrid } from '@material-ui/data-grid'; | ||
|
||
const columns = [ | ||
{ field: 'id', headerName: 'ID', width: 70 }, | ||
{ field: 'firstName', headerName: 'First name', width: 130 }, | ||
{ field: 'lastName', headerName: 'Last name', width: 130 }, | ||
{ | ||
field: 'age', | ||
headerName: 'Age', | ||
type: 'number', | ||
width: 90, | ||
}, | ||
{ | ||
field: 'fullName', | ||
headerName: 'Full name', | ||
description: 'This column has a value getter and is not sortable.', | ||
sortable: false, | ||
width: 160, | ||
valueGetter: (params) => | ||
`${params.getValue('firstName') || ''} ${params.getValue('lastName') || ''}`, | ||
}, | ||
]; | ||
|
||
const rows = [ | ||
{ id: 1, lastName: 'Snow', firstName: 'Jon', age: 35 }, | ||
{ id: 2, lastName: 'Lannister', firstName: 'Cersei', age: 42 }, | ||
{ id: 3, lastName: 'Lannister', firstName: 'Jaime', age: 45 }, | ||
{ id: 4, lastName: 'Stark', firstName: 'Arya', age: 16 }, | ||
{ id: 5, lastName: 'Targaryen', firstName: 'Daenerys', age: null }, | ||
{ id: 6, lastName: 'Melisandre', firstName: null, age: 150 }, | ||
{ id: 7, lastName: 'Clifford', firstName: 'Ferrara', age: 44 }, | ||
{ id: 8, lastName: 'Frances', firstName: 'Rossini', age: 36 }, | ||
{ id: 9, lastName: 'Roxie', firstName: 'Harvey', age: 65 }, | ||
]; | ||
|
||
export default function DataTable() { | ||
return ( | ||
<div style={{ height: 400, width: '100%' }}> | ||
<DataGrid rows={rows} columns={columns} pageSize={5} checkboxSelection /> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import * as React from 'react'; | ||
import { DataGrid, ColDef, ValueGetterParams } from '@material-ui/data-grid'; | ||
|
||
const columns: ColDef[] = [ | ||
{ field: 'id', headerName: 'ID', width: 70 }, | ||
{ field: 'firstName', headerName: 'First name', width: 130 }, | ||
{ field: 'lastName', headerName: 'Last name', width: 130 }, | ||
{ | ||
field: 'age', | ||
headerName: 'Age', | ||
type: 'number', | ||
width: 90, | ||
}, | ||
{ | ||
field: 'fullName', | ||
headerName: 'Full name', | ||
description: 'This column has a value getter and is not sortable.', | ||
sortable: false, | ||
width: 160, | ||
valueGetter: (params: ValueGetterParams) => | ||
`${params.getValue('firstName') || ''} ${params.getValue('lastName') || ''}`, | ||
}, | ||
]; | ||
|
||
const rows = [ | ||
{ id: 1, lastName: 'Snow', firstName: 'Jon', age: 35 }, | ||
{ id: 2, lastName: 'Lannister', firstName: 'Cersei', age: 42 }, | ||
{ id: 3, lastName: 'Lannister', firstName: 'Jaime', age: 45 }, | ||
{ id: 4, lastName: 'Stark', firstName: 'Arya', age: 16 }, | ||
{ id: 5, lastName: 'Targaryen', firstName: 'Daenerys', age: null }, | ||
{ id: 6, lastName: 'Melisandre', firstName: null, age: 150 }, | ||
{ id: 7, lastName: 'Clifford', firstName: 'Ferrara', age: 44 }, | ||
{ id: 8, lastName: 'Frances', firstName: 'Rossini', age: 36 }, | ||
{ id: 9, lastName: 'Roxie', firstName: 'Harvey', age: 65 }, | ||
]; | ||
|
||
export default function DataTable() { | ||
return ( | ||
<div style={{ height: 400, width: '100%' }}> | ||
<DataGrid rows={rows} columns={columns} pageSize={5} checkboxSelection /> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters