-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DataGrid] Add fluid columns width support (#480)
* [DataGrid] Add fluid columns width support * Fix doc formatting * Fix documentation so that it is complient to the MUI documentation standarts * Add unit tests * Update packages/grid/_modules_/grid/hooks/root/useColumns.ts Co-authored-by: Olivier Tassinari <olivier.tassinari@gmail.com> * Update packages/grid/_modules_/grid/models/colDef/colDef.ts Co-authored-by: Olivier Tassinari <olivier.tassinari@gmail.com> * Fix PR comments * Fix unit tests * Resolve TS issues * Add // @ts-expect-error need to migrate helpers to TypeScript before toHaveInlineStyle * Add storybook examples * Update docs/src/pages/components/data-grid/columns/columns.md Co-authored-by: Matt <github@nospam.33m.co> * Update docs/src/pages/components/data-grid/columns/columns.md Co-authored-by: Matt <github@nospam.33m.co> * Update docs/src/pages/components/data-grid/columns/columns.md Co-authored-by: Matt <github@nospam.33m.co> * Update docs/src/pages/components/data-grid/columns/columns.md Co-authored-by: Matt <github@nospam.33m.co> * Update docs/src/pages/components/data-grid/columns/columns.md Co-authored-by: Matt <github@nospam.33m.co> * Update packages/grid/data-grid/src/DataGrid.test.tsx Co-authored-by: Matt <github@nospam.33m.co> * Fix storybook flex col width examples * rerun ci * Fix formatting * Update docs/src/pages/components/data-grid/columns/columns.md * Trigger CI Co-authored-by: Olivier Tassinari <olivier.tassinari@gmail.com> Co-authored-by: Matt <github@nospam.33m.co>
- Loading branch information
1 parent
1071158
commit 4cbde43
Showing
8 changed files
with
300 additions
and
3 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
docs/src/pages/components/data-grid/columns/ColumnFluidWidthGrid.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,34 @@ | ||
import * as React from 'react'; | ||
import { DataGrid } from '@material-ui/data-grid'; | ||
|
||
const rows = [ | ||
{ | ||
id: 1, | ||
username: 'defunkt', | ||
age: 38, | ||
}, | ||
]; | ||
|
||
export default function ColumnFluidWidthGrid() { | ||
return ( | ||
<div style={{ height: 250, width: '100%' }}> | ||
<DataGrid | ||
columns={[ | ||
{ | ||
field: 'id', | ||
flex: 1, | ||
}, | ||
{ | ||
field: 'username', | ||
width: 200, | ||
}, | ||
{ | ||
field: 'age', | ||
flex: 0.3, | ||
}, | ||
]} | ||
rows={rows} | ||
/> | ||
</div> | ||
); | ||
} |
34 changes: 34 additions & 0 deletions
34
docs/src/pages/components/data-grid/columns/ColumnFluidWidthGrid.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,34 @@ | ||
import * as React from 'react'; | ||
import { DataGrid } from '@material-ui/data-grid'; | ||
|
||
const rows = [ | ||
{ | ||
id: 1, | ||
username: 'defunkt', | ||
age: 38, | ||
}, | ||
]; | ||
|
||
export default function ColumnFluidWidthGrid() { | ||
return ( | ||
<div style={{ height: 250, width: '100%' }}> | ||
<DataGrid | ||
columns={[ | ||
{ | ||
field: 'id', | ||
flex: 1, | ||
}, | ||
{ | ||
field: 'username', | ||
width: 200, | ||
}, | ||
{ | ||
field: 'age', | ||
flex: 0.3, | ||
}, | ||
]} | ||
rows={rows} | ||
/> | ||
</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
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