Skip to content

v4.0.0-alpha.34

Compare
Choose a tag to compare
@dtassone dtassone released this 21 Jul 14:54
· 6667 commits to master since this release
d30bae4

July 21, 2021

Big thanks to the 11 contributors who made this release possible. Here are some highlights ✨:

@material-ui/x-grid@v4.0.0-alpha.34 / @material-ui/data-grid@v4.0.0-alpha.34

Breaking changes

  • [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) => }
     />

Changes

Docs

Core