-
-
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.
[DataGrid] Fix resizing right pinned column (@KenanYusuf) (#16193)
- Loading branch information
1 parent
3a95b98
commit 6686de9
Showing
10 changed files
with
315 additions
and
36 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import * as React from 'react'; | ||
import { DataGridPro } from '@mui/x-data-grid-pro'; | ||
import { randomTraderName, randomEmail } from '@mui/x-data-grid-generator'; | ||
|
||
const columns = [ | ||
{ field: 'name', headerName: 'Name', width: 160 }, | ||
{ field: 'email', headerName: 'Email', width: 200 }, | ||
{ field: 'age', headerName: 'Age', type: 'number' }, | ||
]; | ||
|
||
const rows = [ | ||
{ | ||
id: 1, | ||
name: randomTraderName(), | ||
email: randomEmail(), | ||
age: 25, | ||
}, | ||
]; | ||
|
||
export default function DataGridBordered() { | ||
return ( | ||
<div style={{ height: 400, width: '100%' }}> | ||
<DataGridPro rows={rows} columns={columns} showCellVerticalBorder showColumnVerticalBorder /> | ||
</div> | ||
); | ||
} |
32 changes: 32 additions & 0 deletions
32
test/regressions/data-grid/DataGridPinnedColumnsBordered.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,32 @@ | ||
import * as React from 'react'; | ||
import { DataGridPro } from '@mui/x-data-grid-pro'; | ||
import { randomTraderName, randomEmail } from '@mui/x-data-grid-generator'; | ||
|
||
const columns = [ | ||
{ field: 'name', headerName: 'Name', width: 160 }, | ||
{ field: 'email', headerName: 'Email', width: 200 }, | ||
{ field: 'age', headerName: 'Age', type: 'number' }, | ||
]; | ||
|
||
const rows = [ | ||
{ | ||
id: 1, | ||
name: randomTraderName(), | ||
email: randomEmail(), | ||
age: 25, | ||
}, | ||
]; | ||
|
||
export default function DataGridPinnedColumnsBordered() { | ||
return ( | ||
<div style={{ height: 400, width: '100%' }}> | ||
<DataGridPro | ||
rows={rows} | ||
columns={columns} | ||
initialState={{ pinnedColumns: { left: ['name'], right: ['age'] } }} | ||
showCellVerticalBorder | ||
showColumnVerticalBorder | ||
/> | ||
</div> | ||
); | ||
} |
134 changes: 134 additions & 0 deletions
134
test/regressions/data-grid/DataGridPinnedColumnsScrollbars.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,134 @@ | ||
import * as React from 'react'; | ||
import DeleteIcon from '@mui/icons-material/Delete'; | ||
import EditIcon from '@mui/icons-material/Edit'; | ||
import { DataGridPro, GridActionsCellItem } from '@mui/x-data-grid-pro'; | ||
import { | ||
randomCreatedDate, | ||
randomTraderName, | ||
randomEmail, | ||
randomUpdatedDate, | ||
} from '@mui/x-data-grid-generator'; | ||
|
||
const columns = [ | ||
{ field: 'name', headerName: 'Name', width: 160, editable: true }, | ||
{ field: 'email', headerName: 'Email', width: 200, editable: true }, | ||
{ field: 'age', headerName: 'Age', type: 'number', editable: true }, | ||
{ | ||
field: 'dateCreated', | ||
headerName: 'Date Created', | ||
type: 'date', | ||
width: 180, | ||
editable: true, | ||
}, | ||
{ | ||
field: 'lastLogin', | ||
headerName: 'Last Login', | ||
type: 'dateTime', | ||
width: 220, | ||
editable: true, | ||
}, | ||
{ | ||
field: 'actions', | ||
type: 'actions', | ||
width: 100, | ||
getActions: () => [ | ||
<GridActionsCellItem icon={<EditIcon />} label="Edit" />, | ||
<GridActionsCellItem icon={<DeleteIcon />} label="Delete" />, | ||
], | ||
}, | ||
]; | ||
|
||
const rows = [ | ||
{ | ||
id: 1, | ||
name: randomTraderName(), | ||
email: randomEmail(), | ||
age: 25, | ||
dateCreated: randomCreatedDate(), | ||
lastLogin: randomUpdatedDate(), | ||
}, | ||
{ | ||
id: 2, | ||
name: randomTraderName(), | ||
email: randomEmail(), | ||
age: 32, | ||
dateCreated: randomCreatedDate(), | ||
lastLogin: randomUpdatedDate(), | ||
}, | ||
{ | ||
id: 3, | ||
name: randomTraderName(), | ||
email: randomEmail(), | ||
age: 45, | ||
dateCreated: randomCreatedDate(), | ||
lastLogin: randomUpdatedDate(), | ||
}, | ||
{ | ||
id: 4, | ||
name: randomTraderName(), | ||
email: randomEmail(), | ||
age: 28, | ||
dateCreated: randomCreatedDate(), | ||
lastLogin: randomUpdatedDate(), | ||
}, | ||
{ | ||
id: 5, | ||
name: randomTraderName(), | ||
email: randomEmail(), | ||
age: 39, | ||
dateCreated: randomCreatedDate(), | ||
lastLogin: randomUpdatedDate(), | ||
}, | ||
{ | ||
id: 6, | ||
name: randomTraderName(), | ||
email: randomEmail(), | ||
age: 52, | ||
dateCreated: randomCreatedDate(), | ||
lastLogin: randomUpdatedDate(), | ||
}, | ||
{ | ||
id: 7, | ||
name: randomTraderName(), | ||
email: randomEmail(), | ||
age: 33, | ||
dateCreated: randomCreatedDate(), | ||
lastLogin: randomUpdatedDate(), | ||
}, | ||
{ | ||
id: 8, | ||
name: randomTraderName(), | ||
email: randomEmail(), | ||
age: 41, | ||
dateCreated: randomCreatedDate(), | ||
lastLogin: randomUpdatedDate(), | ||
}, | ||
{ | ||
id: 9, | ||
name: randomTraderName(), | ||
email: randomEmail(), | ||
age: 36, | ||
dateCreated: randomCreatedDate(), | ||
lastLogin: randomUpdatedDate(), | ||
}, | ||
{ | ||
id: 10, | ||
name: randomTraderName(), | ||
email: randomEmail(), | ||
age: 29, | ||
dateCreated: randomCreatedDate(), | ||
lastLogin: randomUpdatedDate(), | ||
}, | ||
]; | ||
|
||
export default function DataGridPinnedColumnsScrollbars() { | ||
return ( | ||
<div style={{ height: 400, width: '100%' }}> | ||
<DataGridPro | ||
rows={rows} | ||
columns={columns} | ||
initialState={{ pinnedColumns: { left: ['name'], right: ['actions'] } }} | ||
/> | ||
</div> | ||
); | ||
} |
Oops, something went wrong.