diff --git a/docs/data/data-grid/column-definition/RenderCellGrid.js b/docs/data/data-grid/column-definition/RenderCellGrid.js index 8d5cdcf295d2..f90f52b65de9 100644 --- a/docs/data/data-grid/column-definition/RenderCellGrid.js +++ b/docs/data/data-grid/column-definition/RenderCellGrid.js @@ -49,7 +49,8 @@ RenderDate.propTypes = { */ hasFocus: PropTypes.bool.isRequired, /** - * The cell value, but if the column has valueGetter, use getValue. + * The cell value. + * If the column has `valueGetter`, use `params.row` to directly access the fields. */ value: PropTypes.instanceOf(Date), }; diff --git a/docs/data/data-grid/column-definition/RenderExpandCellGrid.js b/docs/data/data-grid/column-definition/RenderExpandCellGrid.js index fee39abdacc5..4d2eda01e612 100644 --- a/docs/data/data-grid/column-definition/RenderExpandCellGrid.js +++ b/docs/data/data-grid/column-definition/RenderExpandCellGrid.js @@ -119,7 +119,8 @@ renderCellExpand.propTypes = { */ colDef: PropTypes.object.isRequired, /** - * The cell value, but if the column has valueGetter, use getValue. + * The cell value. + * If the column has `valueGetter`, use `params.row` to directly access the fields. */ value: PropTypes.string, }; diff --git a/docs/data/data-grid/editing-legacy/RenderRatingEditCellGrid.js b/docs/data/data-grid/editing-legacy/RenderRatingEditCellGrid.js index 19010efaff5b..2542fd22a946 100644 --- a/docs/data/data-grid/editing-legacy/RenderRatingEditCellGrid.js +++ b/docs/data/data-grid/editing-legacy/RenderRatingEditCellGrid.js @@ -10,7 +10,8 @@ function renderRating(params) { renderRating.propTypes = { /** - * The cell value, but if the column has valueGetter, use getValue. + * The cell value. + * If the column has `valueGetter`, use `params.row` to directly access the fields. */ value: PropTypes.number, }; @@ -65,7 +66,8 @@ RatingEditInputCell.propTypes = { */ id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired, /** - * The cell value, but if the column has valueGetter, use getValue. + * The cell value. + * If the column has `valueGetter`, use `params.row` to directly access the fields. */ value: PropTypes.number, }; diff --git a/docs/data/data-grid/editing/AutoStopEditComponent.js b/docs/data/data-grid/editing/AutoStopEditComponent.js index 0d1be4951402..e72857f982db 100644 --- a/docs/data/data-grid/editing/AutoStopEditComponent.js +++ b/docs/data/data-grid/editing/AutoStopEditComponent.js @@ -38,7 +38,8 @@ SelectEditInputCell.propTypes = { */ id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired, /** - * The cell value, but if the column has valueGetter, use getValue. + * The cell value. + * If the column has `valueGetter`, use `params.row` to directly access the fields. */ value: PropTypes.any, }; diff --git a/docs/data/data-grid/editing/CustomEditComponent.js b/docs/data/data-grid/editing/CustomEditComponent.js index 5c280921cbd5..57d0821094f8 100644 --- a/docs/data/data-grid/editing/CustomEditComponent.js +++ b/docs/data/data-grid/editing/CustomEditComponent.js @@ -10,7 +10,8 @@ function renderRating(params) { renderRating.propTypes = { /** - * The cell value, but if the column has valueGetter, use getValue. + * The cell value. + * If the column has `valueGetter`, use `params.row` to directly access the fields. */ value: PropTypes.number, }; @@ -54,7 +55,8 @@ RatingEditInputCell.propTypes = { */ id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired, /** - * The cell value, but if the column has valueGetter, use getValue. + * The cell value. + * If the column has `valueGetter`, use `params.row` to directly access the fields. */ value: PropTypes.number, }; diff --git a/docs/data/data-grid/editing/EditingWithDatePickers.js b/docs/data/data-grid/editing/EditingWithDatePickers.js index 999d81aaf9cc..ace4b8bacc95 100644 --- a/docs/data/data-grid/editing/EditingWithDatePickers.js +++ b/docs/data/data-grid/editing/EditingWithDatePickers.js @@ -215,7 +215,8 @@ GridEditDateCell.propTypes = { */ id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired, /** - * The cell value, but if the column has valueGetter, use getValue. + * The cell value. + * If the column has `valueGetter`, use `params.row` to directly access the fields. */ value: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.string]), }; diff --git a/docs/data/data-grid/row-height/ExpandableCells.js b/docs/data/data-grid/row-height/ExpandableCells.js index a0463ef9bdb6..b1675a038d3d 100644 --- a/docs/data/data-grid/row-height/ExpandableCells.js +++ b/docs/data/data-grid/row-height/ExpandableCells.js @@ -48,7 +48,8 @@ const ExpandableCell = ({ value }) => { ExpandableCell.propTypes = { /** - * The cell value, but if the column has valueGetter, use getValue. + * The cell value. + * If the column has `valueGetter`, use `params.row` to directly access the fields. */ value: PropTypes.any, }; diff --git a/docs/pages/x/api/data-grid/grid-cell-params.md b/docs/pages/x/api/data-grid/grid-cell-params.md index 202667879815..2c233fae8737 100644 --- a/docs/pages/x/api/data-grid/grid-cell-params.md +++ b/docs/pages/x/api/data-grid/grid-cell-params.md @@ -14,17 +14,17 @@ import { GridCellParams } from '@mui/x-data-grid'; ## Properties -| Name | Type | Description | -| :----------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------- | :--------------------------------------------------------------- | -| cellMode | GridCellMode | The mode of the cell. | -| colDef | GridStateColDef | The column of the row that the current cell belongs to. | -| field | string | The column field of the cell that triggered the event. | -| formattedValue? | F \| undefined | The cell value formatted with the column valueFormatter. | -| getValue | (id: GridRowId, field: string) => any | Get the cell value of a row and field. | -| hasFocus | boolean | If true, the cell is the active element. | -| id | GridRowId | The grid row id. | -| isEditable? | boolean | If true, the cell is editable. | -| row | GridRowModel<R> | The row model of the row that the current cell belongs to. | -| rowNode | GridRowTreeNodeConfig | The node of the row that the current cell belongs to. | -| tabIndex | 0 \| -1 | the tabIndex value. | -| value? | V \| undefined | The cell value, but if the column has valueGetter, use getValue. | +| Name | Type | Description | +| :----------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------- | +| cellMode | GridCellMode | The mode of the cell. | +| colDef | GridStateColDef | The column of the row that the current cell belongs to. | +| field | string | The column field of the cell that triggered the event. | +| formattedValue? | F \| undefined | The cell value formatted with the column valueFormatter. | +| getValue | (id: GridRowId, field: string) => any | Get the cell value of a row and field. | +| hasFocus | boolean | If true, the cell is the active element. | +| id | GridRowId | The grid row id. | +| isEditable? | boolean | If true, the cell is editable. | +| row | GridRowModel<R> | The row model of the row that the current cell belongs to. | +| rowNode | GridRowTreeNodeConfig | The node of the row that the current cell belongs to. | +| tabIndex | 0 \| -1 | the tabIndex value. | +| value? | V \| undefined | The cell value.
If the column has `valueGetter`, use `params.row` to directly access the fields. | diff --git a/packages/grid/x-data-grid-pro/src/components/GridDetailPanelToggleCell.tsx b/packages/grid/x-data-grid-pro/src/components/GridDetailPanelToggleCell.tsx index 2b93510e6c0e..2b388d6dddf0 100644 --- a/packages/grid/x-data-grid-pro/src/components/GridDetailPanelToggleCell.tsx +++ b/packages/grid/x-data-grid-pro/src/components/GridDetailPanelToggleCell.tsx @@ -125,7 +125,8 @@ GridDetailPanelToggleCell.propTypes = { */ tabIndex: PropTypes.oneOf([-1, 0]).isRequired, /** - * The cell value, but if the column has valueGetter, use getValue. + * The cell value. + * If the column has `valueGetter`, use `params.row` to directly access the fields. */ value: PropTypes.any, } as any; diff --git a/packages/grid/x-data-grid-pro/src/components/GridTreeDataGroupingCell.tsx b/packages/grid/x-data-grid-pro/src/components/GridTreeDataGroupingCell.tsx index efaa39c8a6b5..733153536142 100644 --- a/packages/grid/x-data-grid-pro/src/components/GridTreeDataGroupingCell.tsx +++ b/packages/grid/x-data-grid-pro/src/components/GridTreeDataGroupingCell.tsx @@ -164,7 +164,8 @@ GridTreeDataGroupingCell.propTypes = { */ tabIndex: PropTypes.oneOf([-1, 0]).isRequired, /** - * The cell value, but if the column has valueGetter, use getValue. + * The cell value. + * If the column has `valueGetter`, use `params.row` to directly access the fields. */ value: PropTypes.any, } as any; diff --git a/packages/grid/x-data-grid/src/components/cell/GridBooleanCell.tsx b/packages/grid/x-data-grid/src/components/cell/GridBooleanCell.tsx index 1bf3fb3c3fce..a8af71a5e287 100644 --- a/packages/grid/x-data-grid/src/components/cell/GridBooleanCell.tsx +++ b/packages/grid/x-data-grid/src/components/cell/GridBooleanCell.tsx @@ -139,7 +139,8 @@ GridBooleanCellRaw.propTypes = { */ tabIndex: PropTypes.oneOf([-1, 0]).isRequired, /** - * The cell value, but if the column has valueGetter, use getValue. + * The cell value. + * If the column has `valueGetter`, use `params.row` to directly access the fields. */ value: PropTypes.any, } as any; diff --git a/packages/grid/x-data-grid/src/components/cell/GridEditBooleanCell.tsx b/packages/grid/x-data-grid/src/components/cell/GridEditBooleanCell.tsx index e8f4d5514168..d1bfe8f30e63 100644 --- a/packages/grid/x-data-grid/src/components/cell/GridEditBooleanCell.tsx +++ b/packages/grid/x-data-grid/src/components/cell/GridEditBooleanCell.tsx @@ -179,7 +179,8 @@ GridEditBooleanCell.propTypes = { */ tabIndex: PropTypes.oneOf([-1, 0]).isRequired, /** - * The cell value, but if the column has valueGetter, use getValue. + * The cell value. + * If the column has `valueGetter`, use `params.row` to directly access the fields. */ value: PropTypes.any, } as any; diff --git a/packages/grid/x-data-grid/src/components/cell/GridEditDateCell.tsx b/packages/grid/x-data-grid/src/components/cell/GridEditDateCell.tsx index d0dc8b00c302..c4291562b9df 100644 --- a/packages/grid/x-data-grid/src/components/cell/GridEditDateCell.tsx +++ b/packages/grid/x-data-grid/src/components/cell/GridEditDateCell.tsx @@ -229,7 +229,8 @@ GridEditDateCell.propTypes = { */ tabIndex: PropTypes.oneOf([-1, 0]).isRequired, /** - * The cell value, but if the column has valueGetter, use getValue. + * The cell value. + * If the column has `valueGetter`, use `params.row` to directly access the fields. */ value: PropTypes.any, } as any; diff --git a/packages/grid/x-data-grid/src/components/cell/GridEditInputCell.tsx b/packages/grid/x-data-grid/src/components/cell/GridEditInputCell.tsx index 11a51e969ff7..dbfc19723f65 100644 --- a/packages/grid/x-data-grid/src/components/cell/GridEditInputCell.tsx +++ b/packages/grid/x-data-grid/src/components/cell/GridEditInputCell.tsx @@ -193,7 +193,8 @@ GridEditInputCell.propTypes = { */ tabIndex: PropTypes.oneOf([-1, 0]), /** - * The cell value, but if the column has valueGetter, use getValue. + * The cell value. + * If the column has `valueGetter`, use `params.row` to directly access the fields. */ value: PropTypes.any, } as any; diff --git a/packages/grid/x-data-grid/src/components/cell/GridEditSingleSelectCell.tsx b/packages/grid/x-data-grid/src/components/cell/GridEditSingleSelectCell.tsx index 8fd7b96f3fde..51bbc7b9e1d2 100644 --- a/packages/grid/x-data-grid/src/components/cell/GridEditSingleSelectCell.tsx +++ b/packages/grid/x-data-grid/src/components/cell/GridEditSingleSelectCell.tsx @@ -265,7 +265,8 @@ GridEditSingleSelectCell.propTypes = { */ tabIndex: PropTypes.oneOf([-1, 0]).isRequired, /** - * The cell value, but if the column has valueGetter, use getValue. + * The cell value. + * If the column has `valueGetter`, use `params.row` to directly access the fields. */ value: PropTypes.any, } as any; diff --git a/packages/grid/x-data-grid/src/components/columnSelection/GridCellCheckboxRenderer.tsx b/packages/grid/x-data-grid/src/components/columnSelection/GridCellCheckboxRenderer.tsx index 9967db663179..9acac0b7da42 100644 --- a/packages/grid/x-data-grid/src/components/columnSelection/GridCellCheckboxRenderer.tsx +++ b/packages/grid/x-data-grid/src/components/columnSelection/GridCellCheckboxRenderer.tsx @@ -191,7 +191,8 @@ GridCellCheckboxForwardRef.propTypes = { */ tabIndex: PropTypes.oneOf([-1, 0]).isRequired, /** - * The cell value, but if the column has valueGetter, use getValue. + * The cell value. + * If the column has `valueGetter`, use `params.row` to directly access the fields. */ value: PropTypes.any, } as any; diff --git a/packages/grid/x-data-grid/src/models/params/gridCellParams.ts b/packages/grid/x-data-grid/src/models/params/gridCellParams.ts index b5e0958b10a7..cbc012bdecb5 100644 --- a/packages/grid/x-data-grid/src/models/params/gridCellParams.ts +++ b/packages/grid/x-data-grid/src/models/params/gridCellParams.ts @@ -16,7 +16,8 @@ export interface GridCellParams * @deprecated Use the `apiRef` returned by `useGridApiContext` or `useGridApiRef` (only available in `@mui/x-data-grid-pro`) */ api: any; + /** + * The default value for the cell that the `valueGetter` is overriding. + */ + value: GridCellParams['value']; } /**