-
-
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.
[docs] Adds a recipe for the
checkboxSelectionVisibleOnly
prop (#12646
) Signed-off-by: Michel Engelen <[email protected]> Co-authored-by: Andrew Cherniavskii <[email protected]>
- Loading branch information
1 parent
5c35a4b
commit e42a1cf
Showing
3 changed files
with
103 additions
and
0 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
docs/data/data-grid/row-selection/CheckboxSelectionVisibleOnlyGrid.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,48 @@ | ||
import * as React from 'react'; | ||
import { DataGridPro } from '@mui/x-data-grid-pro'; | ||
import { useDemoData } from '@mui/x-data-grid-generator'; | ||
import FormControlLabel from '@mui/material/FormControlLabel'; | ||
import Switch from '@mui/material/Switch'; | ||
import Box from '@mui/material/Box'; | ||
|
||
export default function CheckboxSelectionVisibleOnlyGrid() { | ||
const [checkboxSelectionVisibleOnly, setCheckboxSelectionVisibleOnly] = | ||
React.useState(false); | ||
|
||
const { data } = useDemoData({ | ||
dataSet: 'Commodity', | ||
rowLength: 300, | ||
maxColumns: 5, | ||
}); | ||
|
||
return ( | ||
<div style={{ width: '100%' }}> | ||
<Box sx={{ mb: 1 }}> | ||
<FormControlLabel | ||
label="checkboxSelectionVisibleOnly" | ||
control={ | ||
<Switch | ||
checked={checkboxSelectionVisibleOnly} | ||
onChange={(event) => | ||
setCheckboxSelectionVisibleOnly(event.target.checked) | ||
} | ||
/> | ||
} | ||
/> | ||
</Box> | ||
<div style={{ height: 400 }}> | ||
<DataGridPro | ||
{...data} | ||
initialState={{ | ||
...data.initialState, | ||
pagination: { paginationModel: { pageSize: 50 } }, | ||
}} | ||
pageSizeOptions={[5, 10, 25, 50, 100]} | ||
pagination | ||
checkboxSelection | ||
checkboxSelectionVisibleOnly={checkboxSelectionVisibleOnly} | ||
/> | ||
</div> | ||
</div> | ||
); | ||
} |
48 changes: 48 additions & 0 deletions
48
docs/data/data-grid/row-selection/CheckboxSelectionVisibleOnlyGrid.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,48 @@ | ||
import * as React from 'react'; | ||
import { DataGridPro } from '@mui/x-data-grid-pro'; | ||
import { useDemoData } from '@mui/x-data-grid-generator'; | ||
import FormControlLabel from '@mui/material/FormControlLabel'; | ||
import Switch from '@mui/material/Switch'; | ||
import Box from '@mui/material/Box'; | ||
|
||
export default function CheckboxSelectionVisibleOnlyGrid() { | ||
const [checkboxSelectionVisibleOnly, setCheckboxSelectionVisibleOnly] = | ||
React.useState(false); | ||
|
||
const { data } = useDemoData({ | ||
dataSet: 'Commodity', | ||
rowLength: 300, | ||
maxColumns: 5, | ||
}); | ||
|
||
return ( | ||
<div style={{ width: '100%' }}> | ||
<Box sx={{ mb: 1 }}> | ||
<FormControlLabel | ||
label="checkboxSelectionVisibleOnly" | ||
control={ | ||
<Switch | ||
checked={checkboxSelectionVisibleOnly} | ||
onChange={(event) => | ||
setCheckboxSelectionVisibleOnly(event.target.checked) | ||
} | ||
/> | ||
} | ||
/> | ||
</Box> | ||
<div style={{ height: 400 }}> | ||
<DataGridPro | ||
{...data} | ||
initialState={{ | ||
...data.initialState, | ||
pagination: { paginationModel: { pageSize: 50 } }, | ||
}} | ||
pageSizeOptions={[5, 10, 25, 50, 100]} | ||
pagination | ||
checkboxSelection | ||
checkboxSelectionVisibleOnly={checkboxSelectionVisibleOnly} | ||
/> | ||
</div> | ||
</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