-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6f88bda
commit cde884d
Showing
28 changed files
with
776 additions
and
817 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
17 changes: 17 additions & 0 deletions
17
docs/src/pages/components/data-grid/pagination/200PaginationGrid.js
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,17 @@ | ||
import * as React from 'react'; | ||
import { XGrid } from '@material-ui/x-grid'; | ||
import { useDemoData } from '@material-ui/x-grid-data-generator'; | ||
|
||
export default function BasisPaginationGrid() { | ||
const { data } = useDemoData({ | ||
dataSet: 'Commodity', | ||
rowLength: 1000, | ||
maxColumns: 6, | ||
}); | ||
|
||
return ( | ||
<div style={{ height: 400, width: '100%' }}> | ||
<XGrid pagination pageSize={200} {...data} /> | ||
</div> | ||
); | ||
} |
17 changes: 17 additions & 0 deletions
17
docs/src/pages/components/data-grid/pagination/200PaginationGrid.tsx
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,17 @@ | ||
import * as React from 'react'; | ||
import { XGrid } from '@material-ui/x-grid'; | ||
import { useDemoData } from '@material-ui/x-grid-data-generator'; | ||
|
||
export default function BasisPaginationGrid() { | ||
const { data } = useDemoData({ | ||
dataSet: 'Commodity', | ||
rowLength: 1000, | ||
maxColumns: 6, | ||
}); | ||
|
||
return ( | ||
<div style={{ height: 400, width: '100%' }}> | ||
<XGrid pagination pageSize={200} {...data} /> | ||
</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
24 changes: 24 additions & 0 deletions
24
docs/src/pages/components/data-grid/rows/BasicSortingGrid.js
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,24 @@ | ||
import * as React from 'react'; | ||
import { DataGrid } from '@material-ui/data-grid'; | ||
import { useDemoData } from '@material-ui/x-grid-data-generator'; | ||
|
||
const sortModel = [ | ||
{ | ||
field: 'commodity', | ||
sort: 'asc', | ||
}, | ||
]; | ||
|
||
export default function BasicSortingGrid() { | ||
const { data } = useDemoData({ | ||
dataSet: 'Commodity', | ||
rowLength: 10, | ||
maxColumns: 6, | ||
}); | ||
|
||
return ( | ||
<div style={{ height: 400, width: '100%' }}> | ||
<DataGrid sortModel={sortModel} {...data} /> | ||
</div> | ||
); | ||
} |
24 changes: 24 additions & 0 deletions
24
docs/src/pages/components/data-grid/rows/BasicSortingGrid.tsx
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,24 @@ | ||
import * as React from 'react'; | ||
import { DataGrid, SortDirection } from '@material-ui/data-grid'; | ||
import { useDemoData } from '@material-ui/x-grid-data-generator'; | ||
|
||
const sortModel = [ | ||
{ | ||
field: 'commodity', | ||
sort: 'asc' as SortDirection, | ||
}, | ||
]; | ||
|
||
export default function BasicSortingGrid() { | ||
const { data } = useDemoData({ | ||
dataSet: 'Commodity', | ||
rowLength: 10, | ||
maxColumns: 6, | ||
}); | ||
|
||
return ( | ||
<div style={{ height: 400, width: '100%' }}> | ||
<DataGrid sortModel={sortModel} {...data} /> | ||
</div> | ||
); | ||
} |
83 changes: 83 additions & 0 deletions
83
docs/src/pages/components/data-grid/rows/ComparatorSortingGrid.js
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,83 @@ | ||
import * as React from 'react'; | ||
import { DataGrid } from '@material-ui/data-grid'; | ||
import { | ||
randomCreatedDate, | ||
randomUpdatedDate, | ||
} from '@material-ui/x-grid-data-generator'; | ||
|
||
const columns = [ | ||
{ field: 'id', hide: true }, | ||
{ field: 'name' }, | ||
{ field: 'age', type: 'number' }, | ||
{ | ||
field: 'username', | ||
valueGetter: (params) => | ||
`${params.getValue('name') || 'unknown'} - ${ | ||
params.getValue('age') || 'x' | ||
}`, | ||
sortComparator: (v1, v2, row1, row2) => row1.data.age - row2.data.age, | ||
width: 150, | ||
}, | ||
{ field: 'dateCreated', type: 'date', width: 180 }, | ||
{ field: 'lastLogin', type: 'dateTime', width: 180 }, | ||
]; | ||
|
||
const rows = [ | ||
{ | ||
id: 1, | ||
name: 'Damien', | ||
age: 25, | ||
dateCreated: randomCreatedDate(), | ||
lastLogin: randomUpdatedDate(), | ||
}, | ||
{ | ||
id: 2, | ||
name: 'Nicolas', | ||
age: 36, | ||
dateCreated: randomCreatedDate(), | ||
lastLogin: randomUpdatedDate(), | ||
}, | ||
{ | ||
id: 3, | ||
name: 'Kate', | ||
age: 19, | ||
dateCreated: randomCreatedDate(), | ||
lastLogin: randomUpdatedDate(), | ||
}, | ||
{ | ||
id: 4, | ||
name: 'Sebastien', | ||
age: 28, | ||
dateCreated: randomCreatedDate(), | ||
lastLogin: randomUpdatedDate(), | ||
}, | ||
{ | ||
id: 5, | ||
name: 'Louise', | ||
age: 23, | ||
dateCreated: randomCreatedDate(), | ||
lastLogin: randomUpdatedDate(), | ||
}, | ||
{ | ||
id: 6, | ||
name: 'George', | ||
age: 10, | ||
dateCreated: randomCreatedDate(), | ||
lastLogin: randomUpdatedDate(), | ||
}, | ||
]; | ||
|
||
const sortModel = [ | ||
{ | ||
field: 'username', | ||
sort: 'asc', | ||
}, | ||
]; | ||
|
||
export default function ComparatorSortingGrid() { | ||
return ( | ||
<div style={{ height: 400, width: '100%' }}> | ||
<DataGrid sortModel={sortModel} rows={rows} columns={columns} /> | ||
</div> | ||
); | ||
} |
88 changes: 88 additions & 0 deletions
88
docs/src/pages/components/data-grid/rows/ComparatorSortingGrid.tsx
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,88 @@ | ||
import * as React from 'react'; | ||
import { | ||
Columns, | ||
RowsProp, | ||
DataGrid, | ||
SortDirection, | ||
} from '@material-ui/data-grid'; | ||
import { | ||
randomCreatedDate, | ||
randomUpdatedDate, | ||
} from '@material-ui/x-grid-data-generator'; | ||
|
||
const columns: Columns = [ | ||
{ field: 'id', hide: true }, | ||
{ field: 'name' }, | ||
{ field: 'age', type: 'number' }, | ||
{ | ||
field: 'username', | ||
valueGetter: (params) => | ||
`${params.getValue('name') || 'unknown'} - ${ | ||
params.getValue('age') || 'x' | ||
}`, | ||
sortComparator: (v1, v2, row1, row2) => row1.data.age - row2.data.age, | ||
width: 150, | ||
}, | ||
{ field: 'dateCreated', type: 'date', width: 180 }, | ||
{ field: 'lastLogin', type: 'dateTime', width: 180 }, | ||
]; | ||
|
||
const rows: RowsProp = [ | ||
{ | ||
id: 1, | ||
name: 'Damien', | ||
age: 25, | ||
dateCreated: randomCreatedDate(), | ||
lastLogin: randomUpdatedDate(), | ||
}, | ||
{ | ||
id: 2, | ||
name: 'Nicolas', | ||
age: 36, | ||
dateCreated: randomCreatedDate(), | ||
lastLogin: randomUpdatedDate(), | ||
}, | ||
{ | ||
id: 3, | ||
name: 'Kate', | ||
age: 19, | ||
dateCreated: randomCreatedDate(), | ||
lastLogin: randomUpdatedDate(), | ||
}, | ||
{ | ||
id: 4, | ||
name: 'Sebastien', | ||
age: 28, | ||
dateCreated: randomCreatedDate(), | ||
lastLogin: randomUpdatedDate(), | ||
}, | ||
{ | ||
id: 5, | ||
name: 'Louise', | ||
age: 23, | ||
dateCreated: randomCreatedDate(), | ||
lastLogin: randomUpdatedDate(), | ||
}, | ||
{ | ||
id: 6, | ||
name: 'George', | ||
age: 10, | ||
dateCreated: randomCreatedDate(), | ||
lastLogin: randomUpdatedDate(), | ||
}, | ||
]; | ||
|
||
const sortModel = [ | ||
{ | ||
field: 'username', | ||
sort: 'asc' as SortDirection, | ||
}, | ||
]; | ||
|
||
export default function ComparatorSortingGrid() { | ||
return ( | ||
<div style={{ height: 400, width: '100%' }}> | ||
<DataGrid sortModel={sortModel} rows={rows} columns={columns} /> | ||
</div> | ||
); | ||
} |
23 changes: 23 additions & 0 deletions
23
docs/src/pages/components/data-grid/rows/DisableSortingGrid.js
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,23 @@ | ||
import * as React from 'react'; | ||
import { DataGrid } from '@material-ui/data-grid'; | ||
import { useDemoData } from '@material-ui/x-grid-data-generator'; | ||
|
||
export default function DisableSortingGrid() { | ||
const { data } = useDemoData({ | ||
dataSet: 'Commodity', | ||
rowLength: 10, | ||
maxColumns: 6, | ||
}); | ||
|
||
return ( | ||
<div style={{ height: 400, width: '100%' }}> | ||
<DataGrid | ||
{...data} | ||
columns={data.columns.map((column) => ({ | ||
...column, | ||
sortable: false, | ||
}))} | ||
/> | ||
</div> | ||
); | ||
} |
23 changes: 23 additions & 0 deletions
23
docs/src/pages/components/data-grid/rows/DisableSortingGrid.tsx
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,23 @@ | ||
import * as React from 'react'; | ||
import { DataGrid } from '@material-ui/data-grid'; | ||
import { useDemoData } from '@material-ui/x-grid-data-generator'; | ||
|
||
export default function DisableSortingGrid() { | ||
const { data } = useDemoData({ | ||
dataSet: 'Commodity', | ||
rowLength: 10, | ||
maxColumns: 6, | ||
}); | ||
|
||
return ( | ||
<div style={{ height: 400, width: '100%' }}> | ||
<DataGrid | ||
{...data} | ||
columns={data.columns.map((column) => ({ | ||
...column, | ||
sortable: false, | ||
}))} | ||
/> | ||
</div> | ||
); | ||
} |
Oops, something went wrong.