MUI X: Build complex and data-rich applications using a growing list of advanced React components, like the Data Grid, Date and Time Pickers, Charts, and more!
Published by DanailH almost 3 years ago
Oct 29, 2021
A big thanks to the 5 contributors who made this release possible. Here are some highlights โจ:
valueOptions
from GridColDef
to accept a function (#2850) @alexfauquetteapiRef
methods with unsafe_
(#2985) @flaviendelangle@mui/[email protected]
/ @mui/[email protected]
[DataGridPro] The following methods from apiRef
were renamed. Use the provided alternatives. (#2870) @flaviendelangle
apiRef.current.applyFilters
was renamed to apiRef.current.unsafe_applyFilters
apiRef.current.applyFilterLinkOperator
was renamed to apiRef.current.setFilterLinkOperator
apiRef.current.upsertFilter
was renamed to apiRef.current.upsertFilterItem
apiRef.current.deleteFilter
was renamed to apiRef.current.deleteFilterItem
[DataGridPro] The apiRef.current.applyFilter
method was removed. (#2870) @flaviendelangle
You should never have to call it directly since the filters are already applied when the filterModel
prop changes.
To manually apply the filters, use apiRef.current.unsafe_applyFilters
.
-apiRef.current.applyFilter
+apiRef.current.unsafe_applyFilters
[DataGridPro] Rename filtering, sorting, and rows selectors to match the naming convention (#2942) @flaviendelangle
unorderedGridRowIdsSelector
was renamed to gridRowIdsSelector
sortingGridStateSelector
was renamed to gridSortingStateSelector
sortedGridRowIdsSelector
was renamed to gridSortedRowIdsSelector
visibleSortedGridRowIdsSelector
was renamed to gridVisibleSortedRowIdsSelector
visibleGridRowCountSelector
was renamed to gridVisibleRowCountSelector
filterGridColumnLookupSelector
was renamed to gridFilterActiveItemsSelector
[DataGridPro] The sortedGridRowsSelector
was renamed to gridSortedRowEntriesSelector
(#2942) @flaviendelangle
The return value was also changed as below:
-sortedGridRowsSelector: (state: GridState) => Map<GridRowId, GridRowModel>
-const map = sortedGridRowsSelector(state);
+gridSortedRowEntriesSelector: (state: GridState) => GridRowEntry[]
+const map = new Map(gridSortedRowEntriesSelector(state).map(row => [row.id, row.model]));
[DataGridPro] The visibleSortedGridRowsSelector
was replaced with gridVisibleSortedRowEntriesSelector
(#2942) @flaviendelangle
The return value was also changed as below:
-visibleSortedGridRowsSelector: (state: GridState) => Map<GridRowId, GridRowModel>;
-const map = visibleSortedGridRowsSelector(state);
+gridVisibleSortedRowEntriesSelector: (state: GridState) => GridRowEntry[]
+const map = new Map(gridVisibleSortedRowEntriesSelector(state).map(row => [row.id, row.model]));
[DataGridPro] The visibleSortedGridRowsAsArraySelector
was replaced with gridVisibleSortedRowEntriesSelector
(#2942) @flaviendelangle
The return value was also changed as below:
-visibleSortedGridRowsAsArraySelector: (state: GridState) => [GridRowId, GridRowData][];
+gridVisibleSortedRowEntriesSelector: (state: GridState) => GridRowEntry[]
[DataGridPro] The filterGridItemsCounterSelector
selector was removed. (#2942) @flaviendelangle
Use gridFilterActiveItemsSelector
as replacement.
-const filterCount = filterGridItemsCounterSelector(state);
+const filterCount = gridFilterActiveItemsSelector(state).length;
[DataGridPro] The unorderedGridRowModelsSelector
selector was removed. (#2942) @flaviendelangle
Use apiRef.current.getRowModels
or gridRowIdsSelector
and gridRowsLookupSelector
.
valueOptions
to accept a function (#2850) @alexfauquetteoverridesResolver
(#2995) @DanailHapiRef
methods with unsafe_
(#2985) @flaviendelanglescrollEndThreshold
API docs (#3001) @ZeeshanTambolibuildApi.ts
(#2922) @flaviendelanglecheckboxSelection
toggling (#2979) @flaviendelanglePublished by m4theushw about 3 years ago
Oct 22, 2021
A big thanks to the 5 contributors who made this release possible. Here are some highlights โจ:
@mui/styles
and use the same styling solution from MUI Core (#2784) @DanailHGridRowParams
, GridCellParams
and GridRenderCellParams
(#2436) @ZeeshanTamboli@mui/[email protected]
/ @mui/[email protected]
The DataGrid
and DataGridPro
no longer depends on @mui/styles
. Use styled
to provide custom styling. (#2784) @DanailH
-import { createTheme } from '@mui/material/styles';
-import { makeStyles } from '@mui/styles';
+import { styled } from '@mui/material/styles';
The following CSS classes were renamed:
.MuiDataGrid-gridMenuList
was renamed to .MuiDataGrid-menuList
.MuiGridToolbarContainer-root
was renamed to .MuiDataGrid-toolbarContainer
.MuiGridMenu-root
was renamed to .MuiDataGrid-menu
.MuiDataGridColumnsPanel-root
was renamed to .MuiDataGrid-columnsPanel
.MuiGridPanel-root
was renamed to .MuiDataGrid-panel
.MuiGridPanelContent-root
was renamed to .MuiDataGrid-panelContent
.MuiGridPanelFooter-root
was renamed to .MuiDataGrid-panelFooter
.MuiDataGridPanelHeader-root
was renamed to .MuiDataGrid-panelHeader
.MuiGridPanelWrapper-root
was renamed to .MuiDataGrid-panelWrapper
.MuiGridFilterForm-root
was renamed to .MuiDataGrid-filterForm
.MuiGridToolbarFilterButton-root
was renamed to .MuiDataGrid-toolbarFilterList
[DataGrid] The CSS classes .MuiDataGrid-window
and .MuiDataGrid-windowContainer
were removed (#2673) @m4theushw
The following CSS classes were renamed:
.MuiDataGrid-viewport
was renamed to .MuiDataGrid-virtualScroller
.MuiDataGrid-dataContainer
was renamed to .MuiDataGrid-virtualScrollerContent
.MuiDataGrid-renderingZone
was renamed to .MuiDataGrid-virtualScrollerRenderZone
[DataGrid] Remove the useGridSlotComponentProps
hook and replace it as below: (#2856) @flaviendelangle
-const { apiRef, state, rootElement } = useGridSlotComponentProps();
+const apiRef = useGridApiContext();
+const [state] = useGridState(apiRef);
+const rootElement = apiRef.current.rootElementRef;
[DataGrid] Remove the state
prop and use the initialState
prop (#2848) @flaviendelangle
Note that initialState
only allows the preferencePanel
, filter.filterModel
and sort.sortModel
keys.
To fully control the state, use the the feature's model prop and change callback (e.g. filterModel
and onFilterModelChange
).
<DataGrid
- state={{
+ initialState={{
preferencePanel: {
open: true,
openedPanelValue: GridPreferencePanelsValue.filters,
},
}}
/>
[DataGridPro] Remove the onViewportRowsChange
prop and the viewportRowsChange
event (#2673) @m4theushw
A listener on the rowsScroll
event, as shown below, can be used to replace the prop:
const apiRef = useGridApiRef();
const prevRenderContext = React.useRef(null);
React.useEffect(() => {
return apiRef.current.subscribeEvent("rowsScroll", ({ renderContext }) => {
if (
!prevRenderContext.current ||
renderContext.firstRowIdx !== prevRenderContext.current.firstRowIndex ||
renderContext.lastRowIdx !== prevRenderContext.current.lastRowIndex
) {
prevRenderContext.current = renderContext;
const params = {
firstRowIndex: renderContext.firstRowIndex,
lastRowIndex: renderContext.lastRowIndex
};
}
});
}, [apiRef]);
<DataGridPro apiRef={apiRef} />
valueSetter
(#2876) @m4theushwGridRowParams
, GridCellParams
, GridRenderCellParams
(#2436) @ZeeshanTamboliactions
column type to not select the row when clicking on an item (#2862) @m4theushw@mui/styles
dependency (#2784) @DanailHuseGridSlotComponentProps
(#2856) @flaviendelangleprop.state
with prop.initialState
(#2848) @flaviendelanglerowsScrollEnd
(#2938) @m4theushwGridToolbarFilterButton
(#2841) @alexfauquetteuseGridRowGroupsPreProcessing
internal hook (#2840) @flaviendelanglematerial-ui-utils.ts
(#2872) @DanailHGridSlotComponentProps
interface (#2911) @flaviendelangleGridRowData
with GridRowModel
(#2936) @flaviendelanglePublished by flaviendelangle about 3 years ago
Oct 14, 2021
A big thanks to the 7 contributors who made this release possible. Here are some highlights โจ:
๐ Add the ability to print the grid (#2519) @DanailH
This new feature adds a button to the toolbar to generate a printer-friendly layout. Check the documentation about it.
๐ก Enhance internal code structure
โจ New slots for row
and cell
(#2753) @m4theushw
๐ Documentation improvements
๐ Bugfixes
@mui/[email protected]
/ @mui/[email protected]
[DataGrid] Remove unused event listeners and redundant DOM attributes on GridCell
and GridRow
(#2810) @m4theushw
The following props were removed. If you depend on them, use componentsProps.row
and componentsProps.cell
to pass custom props to the row or cell.
onCellBlur
onCellOver
onCellOut
onCellEnter
onCellLeave
onRowOver
onRowOut
onRowEnter
onRowLeave
For more information, check this page. Example:
-<DataGrid onRowOver={handleRowOver} />;
+<DataGrid
+ componentsProps={{
+ row: { onMouseOver: handleRowOver },
+ }}
+/>;
The data-rowindex
and data-rowselected
attributes were removed from the cell element. Equivalent attributes can be found in the row element.
The data-editable
attribute was removed from the cell element. Use the .MuiDataGrid-cell--editable
CSS class.
The data-mode
attribute was removed from the cell element. Use the .MuiDataGrid-cell--editing
CSS class.
[DataGrid] The state.filter
and state.visibleRows
were merged into a single state.filter
sub-state (#2782) @flaviendelangle
To still access this information, use state.filter
or the selectors as below:
-const filterModel = state.filter
-const filterModel = gridFilterStateSelector(state)
+const filterModel = state.filter.filterModel
+const filterModel = gridFilterModelSelector(state) // preferred method
-const visibleRowsLookup = state.visibleRows.visibleRowsLookup
-const visibleRowsLookup = visibleGridRowsStateSelector(state).visibleRowsLookup
+const visibleRowsLookup = state.filter.visibleRowsLookup
+const visibleRowsLookup = gridVisibleRowsLookupSelector(state).visibleRowsLookup // preferred method
-const visibleRows = state.visibleRows.visibleRows
+const visibleRows = state.filter.visibleRows
+const visibleRows = gridVisibleRowsLookupSelector(state).visibleRows // preferred method
[DataGrid] The CSS classes constants are not exported anymore. Use gridClasses
instead. (#2788) @flaviendelangle
-const columnHeaderClass = GRID_COLUMN_HEADER_CSS_CLASS
+const columnHeaderClass = gridClasses.columnHeader
-const rowClass = GRID_ROW_CSS_CLASS
+const rowClass = gridClasses.row
-const cellClass = GRID_CELL_CSS_CLASS
+const cellClass = gridClasses.cell
-const columnSeparatorClass = GRID_COLUMN_HEADER_SEPARATOR_RESIZABLE_CSS_CLASS
+const columnSeparatorClass = gridClasses['columnSeparator--resizable']
-const columnHeaderTitleClass = GRID_COLUMN_HEADER_TITLE_CSS_CLASS
+const columnHeaderTitleClass = gridClasses.columnHeaderTitle
-const columnHeaderDropZoneClass = GRID_COLUMN_HEADER_DROP_ZONE_CSS_CLASS
+const columnHeaderDropZoneClass = gridClasses.columnHeaderDropZone
-const columnHeaderDraggingClass = GRID_COLUMN_HEADER_DRAGGING_CSS_CLASS
+const columnHeaderDraggingClass = gridClasses["columnHeader--dragging"]
[DataGrid] Rename gridCheckboxSelectionColDef
to GRID_CHECKBOX_SELECTION_COL_DEF
(#2793) @flaviendelangle
- gridCheckboxSelectionColDef
+ GRID_CHECKBOX_SELECTION_COL_DEF
[DataGrid] The constants referring to the column types were removed (#2791) @flaviendelangle
Replace them as below:
-const isColumnString = column.type === GRID_STRING_COLUMN_TYPE;
+const isColumnString = col.type === 'string';
-const isColumnNumber = col.type === GRID_NUMBER_COLUMN_TYPE;
+const isColumnNumber = col.type === 'number';
-const isColumnDate = col.type === GRID_DATE_COLUMN_TYPE;
+const isColumnDate = col.type === 'date';
-const isColumnDateTime = col.type === GRID_DATETIME_COLUMN_TYPE;
+const isColumnDateTime = col.type === 'dateTime';
-const isColumnBoolean = col.type === GRID_BOOLEAN_COLUMN_TYPE;
+const isColumnBoolean = col.type === 'boolean';
[DataGrid] The state initializers were removed (#2782) @flaviendelangle
Use getDefaultGridFilterModel
instead of getInitialGridFilterState
:
-const [filterModel, setFilterModel] = React.useState(getInitialGridFilterState);
+const [filterModel, setFilterModel] = React.useState(getDefaultGridFilterModel);
For the other methods, you can hardcode the value you want to apply:
-const [sortModel, setSortModel] = React.useState(() => getInitialGridSortingState().sortModel);
+const [sortModel, setSortModel] React.useState([]);
-getInitialGridColumnReorderState
-getInitialGridColumnResizeState
-getInitialGridColumnsState
-getInitialGridRenderingState
-getInitialGridRowState
-getInitialGridState
-getInitialVisibleGridRowsState
-getInitialGridState
row
and cell
component slots (#2753) @m4theushwgridCheckboxSelectionColDef
to GRID_CHECKBOX_SELECTION_COL_DEF
(#2793) @flaviendelangleGridRowCells
component (#2811) @m4theushwGridCell
and GridRow
(#2810) @m4theushwprop.checkboxSelectionVisibleOnly
(#2781) @flaviendelangleDataGrid
home page (#2737) @flaviendelanglegetActions
example (#2847) @dstarnerpage
prop docs (#2812) @m4theushwPublished by DanailH about 3 years ago
Oct 7, 2021
A big thanks to the 9 contributors who made this release possible. Here are some highlights โจ:
throttleRowsMs
prop on DataGridPro
and remove the default 100ms row update delay (#2561) @flaviendelangle@mui/[email protected]
/ @mui/[email protected]
[DataGrid] Rename some selectors and interfaces to follow the codebase naming conventions (#2723) @flaviendelangle
The following selectors were renamed:
-const filterModel = filterGridStateSelector(state);
+const filterModel = gridFilterModelSelector(state);
-const density: GridGridDensity = densitySelector(state);
+const density: GridDensityState = gridDensitySelector(state);
-const rendering: InternalRenderingState = gridRenderingSelector(state);
+const rendering: GridRenderingState = gridRenderingSelector(state);
singleSelect
operators (#2666) @jeremyalanundefined
in filter panel (#2715) @DanailHGridMenu
(#2734) @flaviendelangleid
to valueFormatter
(#2738) @m4theushwonSortModelChange
to not be called during initialization (#2724) @flaviendelangleonChange
event argument (#2669) @jayariglesiasid
usage in multiple filters in DataGridPro (#2783) @ZeeshanTamboliuseDemoData
on each render (#2747) @flaviendelangleuseGridColumnMenu
(#2722) @flaviendelangleuseGridRows
high frequency update (#2561) @flaviendelangleeps1lon/actions-label-merge-conflict
action (#2751) @m4theushwPublished by m4theushw about 3 years ago
Sep 29, 2021
This version backports bug fixes and some of the features from the v5.x active release line.
As the development of v5 evolves, newer fixes might not be cherry-picked to the legacy version.
To have access to the latest features it is encouraged to upgrade to MUI X v5 and MUI Core v5.
Big thanks to the 3 contributors who made this release possible. Here are some highlights โจ:
disableVirtualization
prop (#2728) @m4theushw@mui/[email protected]
/ @mui/[email protected]
disableVirtualization
prop (#2728) @m4theushwcheckboxSelectionVisibleOnly
when pagination is enabled (#2731) @flaviendelanglePublished by DanailH about 3 years ago
Aug 27, 2021
๐ This is the first stable release of the data grid component ๐!
We have been iterating on the component for 18 months. With the introduction of the row edit feature, many bug fixes, and polishing of the documentation, we believe the component is ready for a stable release.
The MUI X v4.0.0 release supports MUI Core v4 and has partial support for v5-beta. With the soon-to-be-released v5 version of the core components, we are moving ongoing work to the v5 release line (Core and X).
The support for existing projects on MUI v4 won't be a priority going forward. We encourage you to migrate to MUI Core v5-beta and soon MUI X v5-beta. We don't patch, fix, or alter older versions. Using MUI Core v4 with MUI X v5 might lead to extra bundle size and configuration.
A big thanks to the 6 contributors who made this release possible. Here are some highlights โจ:
๐ Introduce the row editing feature (#2098) @m4theushw
โก๏ธ Rename the XGrid
component to DataGridPro
(#2382) @m4theushw
This should help clarify the products vs. plans separation. MUI X is a product line on its own. It contains MIT and Commercial software. Removing X from the name of the paid components should help remove a possible confusion: the MIT version of X is meant to be valuable enough for developers to use it, without feeling that it's crippled compared to other OSS alternatives.
The Pro suffix should help make it clear what's MIT and what's not.
โจ Rename the @material-ui
npm scope to @mui
(#2341) @oliviertassinari
This is part of the ongoing rebranding of the project and company. Material-UI is our current official name, however, we are going to change it. It's too long to write, read, and pronounce; and it is too closely associated with Material Design. In the near future, the whole project/company is moving to MUI and https://mui.com/.
๐ก The api
property was removed from the callback params. To access the API, use the DataGridPro
(#2312) @DanailH
@mui/[email protected]
/ @mui/[email protected]
[DataGrid] Move packages to @mui
scope and rename XGrid
to DataGridPro
(#2341, #2382) @m4theushw @oliviertassinari
You can find in the above highlight section why we are making these name changes. You can migrate following these steps:
-import { DataGrid } from '@material-ui/data-grid';
+import { DataGrid } from '@mui/x-data-grid';
-import { XGrid } from '@material-ui/x-grid';
-<XGrid />
+import { DataGridPro } from '@mui/x-data-grid-pro';
+<DataGridPro />
[DataGrid] The api
property was removed from the callback params (#2312) @DanailH
To access the API, use the DataGridPro
and get it from the new details
param.
<DataGridPro
- onColumnResize={(params, event) => console.log(params.api)}
+ onColumnResize={(params, event, details) => console.log(details.api)}
/>
[DataGrid] Remove unused row CSS classes (#2327) @ZeeshanTamboli
The CSS classes .Mui-odd
and .Mui-even
were removed from the row.
gridClasses
API instead of hard coded classes (#2320) @m4theushwbox-sizing: border-box
leak (#2330) @m4theushwRow & Cell editing
in features list (#2396) @ZeeshanTamboliXGrid
to DataGridPro
(#2389) @m4theushwonCellEditCommit
param type (#2390) @ArthurPedrotionEditRowsModelChange
prop (#2394) @ZeeshanTambolioptions
internal usage (#2318) @flaviendelangleDataGridPropTypes
(#2432) @flaviendelangleoptions.scrollbarSize
(#2317) @flaviendelangleuseGridColumns
hook (#2343) @oliviertassinaridoesSupportTouchActionNone
implementation (#2378) @DanailH.not.to.equal
in favour of to.not.equal
(#2340) @oliviertassinariPublished by m4theushw about 3 years ago
Sep 24, 2021
A big thanks to the 5 contributors who made this release possible. Here are some highlights โจ:
valueFormatter
to the singleSelect
column type (#2581) @DanailH@mui/[email protected]
/ @mui/[email protected]
[DataGrid] The params passed to the valueFormatter
were changed. (#2581) @DanailH
Use the api
to get the missing params.
The GridValueFormatterParams
interface has the following signature now:
-export type GridValueFormatterParams = Omit<GridRenderCellParams, 'formattedValue' | 'isEditable'>;
+export interface GridValueFormatterParams {
+ /**
+ * The column field of the cell that triggered the event
+ */
+ field: string;
+ /**
+ * The cell value, but if the column has valueGetter, use getValue.
+ */
+ value: GridCellValue;
+ /**
+ * GridApi that let you manipulate the grid.
+ */
+ api: any;
+}
valueFormatter
to singleSelect
select options (#2581) @DanailHPublished by flaviendelangle about 3 years ago
Sep 17, 2021
A big thanks to the 3 contributors who made this release possible.
@mui/[email protected]
/ @mui/[email protected]
Published by flaviendelangle about 3 years ago
Sep 17, 2021
๐ This is the first release with support for the new MUI v5 ๐!
In the next releases, we will be working to bring all the cool features from MUI v5 to the advanced components.
This beta version of MUI X drops support for MUI v4. We encourage everyone to upgrade to MUI v5 to be able to continue to get all the upcoming features and fixes of MUI X. New versions of MUI X v4, containing only fixes, will still be released, but at a slower pace.
A big thanks to the 9 contributors who made this release possible. Here are some highlights โจ:
โก Migrate to the new @mui/material
and @mui/styles
packages and drop support for @material-ui/core
(#2515, #2571, #2620) @m4theushw
๐ Migrate to the new documentation infrastructure and design (#2441) (@DanailH, @m4theushw)
๐ Add actions
column type (#2385) @m4theushw
See the documentation for more details.
๐ Allow to disable virtualization with the disableVirtualization
prop (#2326) @m4theushw
๐ Introduce the new isRowSelected
api method (#2523) @flaviendelangle
๐น๏ธ Show page size controls on smaller resolutions (#2461) @michaldudak
๐ Add Simplified Chinese (zhCN) localization (#2431) @wlf100220
๐ Add Korean (koKR) localization (#2446) @zzossig
๐ Bugfixes
@mui/[email protected]
/ @mui/[email protected]
[DataGridPro] Remove apiRef.current.getState
method.
-const state = apiRef.current.getState();
+const state = apiRef.current.state
[DataGridPro] The third argument in apiRef.current.selectRow
is now inverted to keep consistency with other selection APIs. (#2523) @flaviendelangle
-selectRow: (id: GridRowId, isSelected?: boolean, allowMultiple?: boolean = false) => void;
+selectRow: (id: GridRowId, isSelected?: boolean, resetSelection?: boolean = false) => void;
[DataGrid] Remove the options
prop from the return of useGridSlotComponentProps
.
-const { options } = useGridSlotComponentProps();
+const rootProps = useGridRootProps();
[DataGrid] The module augmentation is not enabled by default. This change was done to prevent conflicts with projects using DataGrid
and DataGridPro
together.
In order to still be able to do overrides at the theme level, add the following imports to your project:
+import type {} from '@mui/x-data-grid/themeAugmentation';
+import type {} from '@mui/x-data-grid-pro/themeAugmentation';
checkboxSelectionVisibleOnly
when pagination is enabled (#2443) @flaviendelangleapiRef.current.getState
method (#2579) @flaviendelangledisableVirtualization
prop (#2326) @m4theushwclasses
prop (#2458) @m4theushwactions
column type (#2385) @m4theushwuseGridColumnResize
and useGridInfiniteLoader
(#2580) @flaviendelangleselectionModel
is used (#2464) @m4theushwuseGridRootProps
(#2621) @flaviendelanglecolumnOrderChange
event after state update (#2451) @flaviendelanglescrollEndThreshold
to undefined (#2574) @flaviendelanglehideFooterRowCount
prop available only for DataGridPro (#2564) @ZeeshanTamboliGridColumnHeaderMenu
(#2463) @DanailHGridToolbarContainer
styles (#2462) @michaldudak@material-ui/icons
(#2576) @m4theushwGridSimpleOptions
interface (#2578) @flaviendelangleGridEventEmitter
per Grid (#2504) @flaviendelanglenext
instead of master
(#2566) @flaviendelanglex-grid-data-generator
for noImplicitAny (#2505) @flaviendelangleGridEvents.rowsSet
when the rows state is modified after props.rows
is updated (#2530) @flaviendelanglestate.isScrolling
(#2337) @m4theushw@material-ui
usages (#2577) @m4theushw@mui
packages (#2571) @m4theushwuseGridApiEventHandler
(#2557) @flaviendelangle.browserslistrc
file (#2384) @DanailHPublished by m4theushw about 3 years ago
Jul 12, 2021
Big thanks to the 7 contributors who made this release possible. Here are some highlights โจ:
onViewportRowsChange
prop for XGrid
only (#2038) @DanailHThis is the last alpha release. We are moving to beta in the next release, next week.
@material-ui/[email protected]
/ @material-ui/[email protected]
[DataGrid] Drop support for @material-ui/core below v4.12.0 (#2281) @DanailH
[XGrid] Replace event constants with the GridEvents
enum (#2279) @flaviendelangle
-import { GRID_CELL_EDIT_START } from '@material-ui/x-grid';
-apiRef.current.subscribeEvent(GRID_CELL_EDIT_START, (params, event) => { ... });
+import { GridEvents } from '@material-ui/x-grid';
+apiRef.current.subscribeEvent(GridEvents.cellEditStart, (params, event) => { ... });
valueOptions
is missing in the GridColDef
when using singleSelect
(#2276) @DanailHautoFocus
attribute (#2239) @m4theushwrenderCell
returns false-ish values (#2242) @siriwatknpuseGridVirtualColumns
into useGridVirtualRows
(#2314) @m4theushwonViewportRowsChange
prop (#2038) @DanailHevent.defaultMuiPrevented
is called (#2302) @oliviertassinarigetState
(#2300) @oliviertassinarirangeStrategy: bump
@oliviertassinaricolDef
(#2188) @flaviendelanglePublished by DanailH about 3 years ago
August 6, 2021
Big thanks to the 6 contributors who made this release possible. Here are some highlights โจ:
details
param to each callback option in XGrid
(#2236) @DanailH@material-ui/[email protected]
/ @material-ui/[email protected]
[DataGrid] Polish cell editing (#2220) @m4theushw
onCellModeChange
prop with onCellEditEnter
or onCellEditExit
.onCellEditEnter
prop to onCellEditStart
.onCellEditEnd
prop to onCellEditStop
. <DataGrid
- onCellEditEnter={...}
- onCellEditExit={...}
+ onCellEditStart={...}
+ onCellEditStop={...}
/>
setEditCellProps
API call is not available anymore.setEditRowsModel
.-apiRef.current.setEditCellProps({ id, field, props: { ...props, error: true } });
+apiRef.current.setEditRowsModel({
+ ...oldModel,
+ [id]: {
+ ...oldModel[id],
+ [field]: { ...oldModel[id][field], error: true },
+ },
+});
[DataGrid] Allow non-integer column width for flex columns (#2282) @flaviendelangle
width
property of the columns is no longer updated with the actual width of of the column. Use the new computedWidth
property in the callbacks instead.const columns: GridColDef = [
{
field: "name",
width: 100,
renderCell: ({ value, colDef }) => {
- console.log(colDef.width!)
+ console.log(colDef.computedWidth)
return value
}
]
details
param to each callback option in XGrid
(#2236) @DanailHDataGrid
and XGrid
(#2176) @dtassoneGridFilterModel
in the models directory (#2243) @flaviendelanglecomputedWidth
field (#2235) @flaviendelanglerootProps
instead of options
in the grid components except for classes
(#2213) @flaviendelanglerebaseWhen=auto
not working (#2271) @oliviertassinariJuly 31, 2021
Big thanks to the 8 contributors who made this release possible. Here are some highlights โจ:
@material-ui/[email protected]
/ @material-ui/[email protected]
[DataGrid] Improve controllable cell edit (#2143) @m4theushw
onEditCellChange
prop was renamed to onEditCellPropsChange
.onEditCellChangeCommitted
prop was renamed to onCellEditCommit
.onEditRowModelChange
prop was removed. Use the new onEditRowsModelChange
prop.
-onEditRowModelChange?: (params: GridEditRowModelParams)
+onEditRowsModelChange?: (editRowsModel: GridEditRowsModel)
[XGrid] Improve controllable cell edit (#2143) @m4theushw
cellEditPropsChange
event was renamed to editCellPropsChange
.cellEditPropsChangeCommitted
event was renamed to cellEditCommit
.cellValueChange
event was removed. Listen to cellEditCommit
to detect when the value is committed.editRowModelChange
event was renamed to editRowsModelChange
.[DataGrid] Improve controllable pagination (#2099) @flaviendelangle
The pageSize
is now a controlled prop. If you set a value, you also need to handle updates with onPageSizeChange. See the documentation.
Change the controllable API signature:
// Signature
-onPageChange?: (params: GridPageChangeParams) => void;
+onPageChange?: (page: number) => void;
// Usage
-<DataGrid onPageChange={(params: GridPageChangeParams) => setPage(params.page)} />
+<DataGrid onPageChange={(page: number) => setPage(page)} />
// Signature
-onPageSizeChange?: (params: GridPageChangeParams) => void;
+onPageSizeChange?: (pageSize: number) => void;
// Usage
-<DataGrid onPageSizeChange={(params: GridPageChangeParams) => setPageSize(params.pageSize)} />
+<DataGrid onPageSizeChange={(pageSize: number) => setPageSize(pageSize)} />
Controlled selection
console error (#2197) @ZeeshanTambolidisableMultipleColumnsFiltering
console warning @ZeeshanTamboliPublished by dtassone over 3 years ago
July 21, 2021
Big thanks to the 11 contributors who made this release possible. Here are some highlights โจ:
[DataGrid] Fix scrollToIndexes behavior (#2162) @oliviertassinari
Remove public apiRef.current.isColumnVisibleInWindow()
as it servers private use cases.
-apiRef.current.isColumnVisibleInWindow()
[DataGrid] Remove stateId argument from GridApi getState method (#2141) @flaviendelangle
-const filterState = apiRef.current.getState('filter');
+const filterState = apiRef.current.getState().filter;
[DataGrid] Improve controllable sorting (#2095) @dtassone
Normalize the controlled prop signature:
<DataGrid
- onSortModelChange={(params: GridSortModelParams) => setSortModel(params.model)}
+ onSortModelChange={(model: GridSortModel) => setSortModel(model)}
/>
[DataGrid] Improve controllable filter (#1909) @dtassone
Normalize the controlled prop signature:
<DataGrid
- onFilterModelChange={(params: GridFilterModelParams) => setFilterModel(params.model)}
+ onFilterModelChange={(model: GridFilterModel) => setFilterModel(model)}
/>
[DataGrid] Improve the editing API (#1955) @m4theushw
The props
key in the first argument of commitCellChange
was removed to promote the use of the value already stored in the state.
To update the value in the state, call setEditCellProps
before.
-apiRef.current.commitCellChange({ id: 1, field: 'name', props: { value: 'Ana' } });
+apiRef.current.setEditCellProps({ id: 1, field: 'name', props: { value: 'Ana' } });
+apiRef.current.commitCellChange({ id: 1, field: 'name' });
Calling commitCellChange
in a cell in view mode will throw an error. Make sure to first enter the edit mode.
+apiRef.current.setCellMode(1, 'name', 'edit');
apiRef.current.commitCellChange({ id: 1, field: 'name' });
The setCellValue
was removed from the API. Use commitCellChange
or updateRows
in place.
-apiRef.current.setCellValue({ id: 1, field: 'name', value: 'Ana' });
+apiRef.current.updateRows([{ id: 1, name: 'Ana' }]);
or
-apiRef.current.setCellValue({ id: 1, field: 'name', value: 'Ana' });
+apiRef.current.setCellMode(1, 'name', 'edit');
+apiRef.current.setEditCellProps({ id: 1, field: 'name', props: { value: 'Ana' } });
+apiRef.current.commitCellChange({ id: 1, field: 'name' });
The getEditCellProps
was removed because getEditCellPropsParams
offers the same functionality.
-const props = apiRef.current.getEditCellProps(1, 'name');
+const { props } = apiRef.current.getEditCellPropsParams(1, 'name');
Note: This method will now throw an error if the cell is in view mode.
[DataGrid] Implement useControlState hook, and add control state on selectionModel (#1823) @dtassone
Normalize the controlled prop signature:
<DataGrid
- onSelectionModelChange={(params: GridSelectionModelChangeParams) => setSelectionModel(params.model)}
+ onSelectionModelChange={(model: GridSelectionModel) => setSelectionModel(model)}
/>
Replace onRowSelected
with the existing API:
<DataGrid
- onRowSelected={(params: GridRowSelectedParams) => }
+ onSelectionModelChange={(model: GridSelectionModel) => }
/>
minWidth
to GridColDef
(#2101) @DanailHpageSizeChange
when autoPageSize is set and the grid size changes (#1986) @flaviendelangle@material-ui/[email protected]
(#2108) @DanailHeditMode
prop (#2173) @ZeeshanTambolionSelectionModelChange
(#1966) @DanailHdocs:api
script in Windows OS (#2166) @ZeeshanTamboliPublished by DanailH over 3 years ago
July 1, 2021
Big thanks to the 6 contributors who made this release possible. Here are some highlights โจ:
๐ As a focus of Q2, we have kept fixing bugs
๐ End users are now allowed to copy the selected rows to the clipboard with CTRL + c (#1929) @m4theushw
๐ We have fixed the Select all
checkbox. When triggered, it should only select the filtered rows (#1879) @ZeeshanTamboli
โก๏ธ We have added a new singleSelect
column type (#1956) @DanailH
Using the column type: 'singleSelect'
defaults to Select
component when the cell is in edit
mode. You can find the documentation following this link.
<DataGrid
columns={[
{
field: 'country',
type: 'singleSelect',
valueOptions: ['France', 'Netherlands', 'Brazil'],
editable: true,
}
]}
rows={[
{ id: 0, country: 'France' },
{ id: 1, country: 'Netherlands' },
{ id: 2, country: 'Brazil' },
]}
/>
[DataGrid] Rename onColumnResizeCommitted
to onColumnWidthChange
(#1967) @m4theushw
-<DataGrid onColumnResizeCommitted={...} />
+<DataGrid onColumnWidthChange={...} />
[DataGrid] Make GRID_ROWS_CLEAR private (#1925) @oliviertassinari
The rowsCleared
event was always triggered alongside rowsSet
. You can listen to the latter event only.
[DataGrid] Fix events naming (#1862) @m4theushw
The following XGrid
events were renamed:
columnHeaderNavigationKeydown
to columnHeaderNavigationKeyDown
columnResizeCommitted
to columnWidthChange
rowsUpdated
to rowsUpdate
columnsUpdated
to columnsChange
The following XGrid
DOM events were removed:
focusout
keydown
keyup
scrollToIndexes
(#1969) @oliviertassinariscrollToIndexes
(#1949) @oliviertassinariSelect all
checkbox click should select only filtered rows (#1879) @ZeeshanTamboliPublished by m4theushw over 3 years ago
June 18, 2021
Big thanks to the 10 contributors who made this release possible. Here are some highlights โจ:
Select
and Autocomplete
, can now be used in the cell editing (#1772) @m4theushwvalueFormatter
to the CSV exporting (#1922) @DanailH[DataGrid] The onEditCellChangeCommitted
prop won't be called with an event when committing changes by clicking outside the cell (#1910) @m4theushw
[DataGrid] Translation for Material-UI Core components are no longer included in the Material-UI X translation (#1913) @DanailH
import { createMuiTheme, ThemeProvider } from '@material-ui/core/styles';
import { DataGrid, bgBG } from '@material-ui/data-grid';
+import { bgBG as coreBgBG } from '@material-ui/core/locale';
const theme = createMuiTheme(
{
// ...
},
bgBG,
+ coreBgBG,
);
[DataGrid] The disableClickEventBubbling
prop was removed (#1910) @m4theushw
The same outcome can be obtained by using the React synthetic event, calling event.stopPropagation()
:
-<DataGrid disableClickEventBubbling />
+<DataGrid onCellClick={(event) => event.stopPropagation()} />
[DataGrid] Rename CSS classes according to new convention (#1872) @DanailH
The main grid components:
.data-container
was removed.MuiDataGrid-columnHeaderSortable
was renamed to .MuiDataGrid-columnHeader--sortable
.MuiDataGrid-columnHeaderCenter
was renamed to .MuiDataGrid-columnHeader--alignCenter
.MuiDataGrid-columnHeaderRight
was renamed to .MuiDataGrid-columnHeader--alignRight
.MuiDataGrid-columnHeader-draggable
was renamed to .MuiDataGrid-columnHeaderDraggableContainer
.MuiDataGrid-columnHeaderSortable
was renamed to .MuiDataGrid-columnHeader--sortable
.MuiDataGrid-columnHeaderMoving
was renamed to .MuiDataGrid-columnHeader--moving
.MuiDataGrid-columnHeaderSorted
was renamed to .MuiDataGrid-columnHeader--sorted
.MuiDataGrid-columnHeaderNumeric
was renamed to .MuiDataGrid-columnHeader--numeric
.MuiDataGrid-columnHeader-dropZone
was renamed to .MuiDataGrid-columnHeaderDropZone
.MuiDataGrid-columnSeparatorResizable
was renamed to .MuiDataGrid-columnSeparator--resizable
.MuiDataGrid-cellWithRenderer
was renamed to .MuiDataGrid-cell--withRenderer
.MuiDataGrid-cellLeft
was renamed to .MuiDataGrid-cell--textLeft
.MuiDataGrid-cellRight
was renamed to .MuiDataGrid-cell--textRight
.MuiDataGrid-cellCenter
was renamed to .MuiDataGrid-cell--textCenter
.MuiDataGrid-cellEditing
was renamed to .MuiDataGrid-cell--editing
.MuiDataGrid-cellEditable
was renamed to .MuiDataGrid-cell--editable
.MuiDataGrid-editCellBoolean
was renamed to .MuiDataGrid-editBooleanCell
.MuiDataGrid-editCellInputBase
was renamed to .MuiDataGrid-editInputCell
.MuiDataGrid-scrollArea-left
was renamed to .MuiDataGrid-scrollArea--left
.MuiDataGrid-scrollArea-right
was renamed to .MuiDataGrid-scrollArea--right
The standalone components:
.MuiDataGridMenu-*
was renamed to .MuiGridMenu-*
.MuiDataGridPanel-*
was renamed to .MuiGridPanel-*
.MuiDataGridPanelContent-*
was renamed to .MuiGridPanelContent-*
.MuiDataGridPanelFooter-*
was renamed to .MuiGridPanelFooter-*
.MuiDataGridPanelWrapper-*
was renamed to .MuiGridPanelWrapper-*
.MuiDataGridFilterForm-*
was renamed to .MuiGridFilterForm-*
.MuiDataGridToolbarFilterButton-*
was renamed to .MuiGridToolbarFilterButton-*
.MuiDataGrid-footer
was renamed to .MuiDataGrid-footerContainer
.MuiDataGrid-toolbar
was renamed to .MuiDataGrid-toolbarContainer
aria-label
to GridToolbarExport
(#1869) @rbrishabhuseGridApiContext
hook to access the GridApiContext
(#1877) @m4theushwGridExportCsvOptions
(#1859) @michallukowskigetRowId
on cell editing (#1917) @m4theushwlocaleText
(#1913) @DanailHvalueFormatter
(#1922) @DanailHdisableClickEventBubbling
(#1910) @m4theushwdisableDensitySelector
description (#1884) @oliviertassinariPublished by DanailH over 3 years ago
June 9, 2021
Big thanks to the 6 contributors who made this release possible. Here are some highlights โจ:
[DataGrid] Improve headerClassName
type (#1778) @DanailH
cellClassName
and headerClassName
no longer accept array of strings.
-cellClassName?: string | string[] | (params: GridCellParams) => string;
+cellClassName?: string | (params: GridCellParams) => string;
-headerClassName?: string | string[];
+headerClassName?: string | (params: GridColumnHeaderParams) => string;
valueParser
to parse values entered by the user (#1785) @m4theushwviewportWidth
< 0 (#1816) @DanailHdisableDensitySelector
option (#1856) @DanailHyarn docs:api
@oliviertassinariPublished by dtassone over 3 years ago
May 31, 2021
Big thanks to the 8 contributors who made this release possible. Here are some highlights โจ:
getCellClassName
prop (#1687) @m4theushwcellClassRules
from GridColDef
(#1716) @m4theushw[DataGrid] Rename toolbar components for consistency (#1724) @DanailH
Prefix all the toolbar-related components with GridToolbar
.
-.MuiDataGridFilterToolbarButton-list
+.MuiDataGridToolbarFilterButton-list
-<GridColumnsToolbarButton />
+<GridToolbarColumnsButton />
-<GridFilterToolbarButton />
+<GridToolbarFilterButton />
-<GridDensitySelector />
+<GridToolbarDensitySelector />
[DataGrid] Remove cellClassRules
from GridColDef
(#1716) @m4theushw
The GridCellClassParams
type is not exported anymore. Replace it with GridCellParams
.
-import { GridCellClassParams} from '@material-ui/data-grid';
+import { GridCellParams } from '@material-ui/data-grid';
-cellClassName: (params: GridCellClassParams) =>
+cellClassName: (params: GridCellParams) =>
The cellClassRules
in GridColDef
was removed because it's redundant. The same functionality can be obtained using cellClassName
and the clsx
utility:
+import clsx from 'clsx';
{
field: 'age',
width: 150,
- cellClassRules: {
- negative: params => params.value < 0,
- positive: params => params.value > 0,
- },
+ cellClassName: params => clsx({
+ negative: params.value < 0,
+ positive: params.value > 0,
+ }),
}
[DataGrid] Fix onPageChange
doesn't update the page
when a pagination button is clicked (#1719) @ZeeshanTamboli
Fix naming of pageChange
and pageSizeChange
events variables. The correct event variable name should be prefixed with GRID_
and converted to UPPER_CASE.
-import { GRID_PAGESIZE_CHANGED, GRID_PAGE_CHANGED } from '@material-ui/data-grid';
+import { GRID_PAGESIZE_CHANGE, GRID_PAGE_CHANGE } from '@material-ui/data-grid';
[XGrid] The getEditCellValueParams
method was removed from the apiRef
(#1767) @m4theushw
The getEditCellValueParams
method was almost a straightforward alias of getEditCellPropsParams
.
-const { value } = apiRef.current.getEditCellValueParams(id, field);
+const { props: { value } } = apiRef.current.getEditCellPropsParams(id, field);
getCellClassName
prop (#1687) @m4theushwaria-label
, aria-labelledby
field (#1764) @ZeeshanTambolirowCount
prop updates (#1697) @dtassoneonFilterModelChange
not firing (#1706) @dtassoneGridRowParams.getValue
(#1731) @visshaljagtapGridApi
descriptions (#1767) @m4theushwPublished by m4theushw over 3 years ago
May 19, 2021
Big thanks to the 11 contributors who made this release possible. Here are some highlights โจ:
๐ Performance increased when filtering, sorting, and rendering (#1513) @dtassone
๐
Add columnHeader
, row
and cell
to the classes
prop (#1660) @DanailH
โ
Add the isRowSelectable
prop to disable selection on certain rows (#1659) @m4theushw
See the documentation for more details.
โก๏ธ Add new icon slot to be displayed when the column is unsorted (#1415) @m4theushw
โ Improve consistency of the API to prepare for the first beta release
๐ Bugfixes
[DataGrid] Remove the properties element
, rowIndex
, and colIndex
from all params
arguments (#1513) @dtassone
You can use the following apiRef
methods to replace some of them:
-params.rowIndex
-params.colIndex
+apiRef.current.getRowIndex(params.id)
+apiRef.current.getColumnIndex(params.field)
[DataGrid] Calling params.getValue
now requires the id to be passed (#1513) @dtassone
-params.getValue(field)
+params.getValue(params.id, field)
[DataGrid] Rename CSS classes (#1660) @DanailH
MuiDataGrid-colCellWrapper
to MuiDataGrid-columnHeaderWrapper
MuiDataGrid-colCell
to MuiDataGrid-columnHeader
MuiDataGrid-colCellCheckbox
to MuiDataGrid-columnHeaderCheckbox
MuiDataGrid-colCellSortable
to MuiDataGrid-columnHeaderSortable
MuiDataGrid-colCellCenter
to MuiDataGrid-columnHeaderCenter
MuiDataGrid-colCellLeft
to MuiDataGrid-columnHeaderLeft
MuiDataGrid-colCellRight
to MuiDataGrid-columnHeaderRight
[XGrid] Calling setCellFocus
now requires the id and field to be passed (#1513) @dtassone
-apiRef.current.setCellFocus: (indexes: GridCellIndexCoordinates) => void;
+apiRef.current.setCellFocus: (id: GridRowId, field: string) => void;
[XGrid] Rename apiRef
methods (#1513) @dtassone
Changes on apiRef.current
:
-apiRef.current.getRowIndexFromId: (id: GridRowId) => number;
+apiRef.current.getRowIndex: (id: GridRowId) => number;
[XGrid] Rename apiRef
methods (#1667) @m4theushw
Changes on apiRef.current
:
-apiRef.current.getColumnFromField: (field: string) => GridColDef;
-apiRef.current.getRowFromId: (id: GridRowId) => GridRowModel;
+apiRef.current.getColumn: (field: string) => GridColDef;
+apiRef.current.getRow: (id: GridRowId) => GridRowModel;
columnHeader
, row
and cell
in addition to root
in classes prop (#1660) @DanailHisRowSelectable
prop (#1659) @m4theushwid
and aria-labelledby
attributes on the column menu (#1460) @m4theushwGridFilterApi
(#1620) @m4theushwmakeStyles
dependency on @material-ui/core/styles
(#1627) @mnajdovawithStyles
dependency on @material-ui/core/styles
(#1690) @mnajdovaclassnames
utility with clsx
dependency (#1586) @ZeeshanTambolicolIndex
already computed (#1666) @oliviertassinariPublished by DanailH over 3 years ago
May 10, 2021
Big thanks to the 5 contributors who made this release possible. Here are some highlights โจ:
onColumnVisibilityChange
prop (#1578) @DanailH[XGrid] Rename apiRef toggleColumn
method for consistency (#1578) @DanailH
-apiRef.current.toggleColumn: (field: string, forceHide?: boolean) => void;
+apiRef.current.setColumnVisibility: (field: string, isVisible: boolean) => void;
[XGrid] Fix event typo (#1574) @DanailH
-import { GRID_COLUMN_RESIZE_COMMITEDย } from '@material-ui/x-grid';
+import { GRID_COLUMN_RESIZE_COMMITTEDย } from '@material-ui/x-grid';
onColumnVisibilityChange
prop (#1578) @DanailHEdit using external button
demo (#1515) @ZeeshanTambolionColumnResizeCommitted
prop (#1563) @ZeeshanTamboliGridApi
type structure (#1566) @oliviertassinariPublished by dtassone over 3 years ago
Apr 30, 2021
Big thanks to the 9 contributors who made this release possible. Here are some highlights โจ:
[core] Drop support for Node v10 (#1499) @ZeeshanTamboli
[XGrid] Remove onAction
APIs (#1453) @DanailH
These event handlers on the apiRef were duplicating with the react props
and the event subscribe API. Changes on apiRef.current
:
-onFilterModelChange
-onPageChange
-onPageSizeChange
-onResize
-onUnmount
-onRowSelected
-onSelectionModelChange
-onSortModelChange
-onStateChange
Note: These methods are available as React props.
[XGrid] Refactor useGridColumnResize (#1380) @DanailH
Changes on apiRef.current
:
-startResizeOnMouseDown
+setColumnWidth
classes
prop (#1450) @ZeeshanTamboli