Applies the current sort model to the rows.
Run the processor registered for the active strategy.
Auto-size the columns of the grid based on the cells' content and the space available.
Optional
options: GridAutosizeOptionsThe autosizing options
A promise that resolves when autosizing is completed
The caches used by hooks and state initializers.
Calculate column spanning for each cell in the row
The options to apply on the calculation.
List of columns to calculate colSpan for
Last visible column index
First visible column index
The row id
The React ref of the grid column container virtualized div element.
Deletes a [[GridFilterItem]].
The filter to delete.
Determines if the height of a detail panel is "auto".
The id of the row.
true
if the detail panel height is "auto".
The generic event emitter manager.
Downloads and exports a CSV of the grid's data.
Optional
options: GridCsvExportOptionsThe options to apply on the export.
Print the grid's data.
Optional
options: GridPrintExportOptionsThe options to apply on the export.
Generates a serializable object containing the exportable parts of the DataGrid state.
These values can then be passed to the initialState
prop or injected using the restoreState
method.
Optional
params: GridExportStateParamsWith all properties from [[GridExportStateParams]]
The exported state.
Initiates the fetch of the children of a row.
The id of the group to be fetched.
Forces the grid to rerender. It's often used after a state update.
Returns the name of the active strategy of a given strategy group
The group from which we want the active strategy.
The name of the active strategy.
Returns an array of [[GridColDef]] containing all the column definitions.
An array of [[GridStateColDef]].
Returns the column group lookup.
The column group lookup.
Gets the list of row ids. TODO rows v6: Rename or remove ?
Gets the [[GridCellParams]] object that is passed as argument in events.
The id of the row.
The column field.
The cell params.
Gets the mode of a cell.
The id of the row.
The field to get the mode.
Returns "edit"
or "view"
.
Gets the [[GridCellParams]] object that is passed as argument in events.
The id of the row.
The column field.
The cell params.
Used internally to render the cell based on existing row data provided by the GridRow.
The id of the row.
The column field.
The row model.
The cell params.
The cell params.
Gets the value of a cell at the given id
and field
.
Returns the [[GridColDef]] for the given field
.
The column field.
The [[GridStateColDef]].
Gets the focus to the column group header at the given field
and given depth.
focused
Returns the id of the groups leading to the requested column. The array is ordered by increasing depth (the last element is the direct parent of the column).
The field of of the column requested.
The id of the groups leading to the requested column.
Gets the underlying DOM element for the column header with the given field
.
The column field.
The DOM element or null
.
Gets the [[GridColumnHeaderParams]] object that is passed as argument in events.
The column field.
The cell params.
Returns the index position of a column. By default, only the visible columns are considered.
Pass false
to useVisibleColumns
to consider all columns.
The column field.
Optional
useVisibleColumns: booleanDetermines if all columns or the visible ones should be considered. Default is true
.
The index position.
Gets the index of a column relative to the columns that are reachable by scroll.
The column field.
The index of the column.
Returns the left-position of a column relative to the inner border of the grid.
The column field.
The position in pixels.
Returns the grid data as a CSV string.
This method is used internally by exportDataAsCsv
.
Optional
options: GridCsvExportOptionsThe options to apply on the export.
The data in the CSV format.
Returns the rows whose detail panel is open.
Returns the filter state for the given filter model without applying it to the Data Grid.
The filter model to get the state for.
The filter state.
Optional
getReturns the index of the last row measured. The value considers only the rows reachable by scroll, for example first row has index=0 in all pages.
The index of the last measured row.
Returns the translation for the key
.
One of the keys in [[GridLocaleText]].
The translated value.
Returns which columns are pinned.
An object containing the pinned columns.
Returns the modified selection model after applying row selection propagation.
Use this to achieve proper rowSelectionPropagation
behavior when setting the selection model using setRowSelectionModel
.
The selection model to propagate.
The modified selection model.
Returns the public API.
Can be useful on a feature hook if we want to pass the apiRef
to a callback.
Do not use it to access the public method in private parts of the codebase.
The public api.
Returns the dimensions of the grid
The dimension information of the grid. If null
, the grid is not ready yet.
Gets the row data with a given id.
The id of the row.
The row data.
Gets the underlying DOM element for a row at the given id
.
The id of the row.
The DOM element or null
.
Gets the rows of a grouping criteria. Only contains the rows provided to the grid, not the rows automatically generated by it.
Object containing parameters for the getter.
The id of each row in the grouping criteria.
Get the height entry from the cache or create one.
The id of the row.
The height cache entry
Gets the ID of a row given its data.
The row data.
The id of the row.
Gets the GridRowId
of a row at a specific index.
The index is based on the sorted but unfiltered row list.
Gets the index of a row relative to the rows that are reachable by scroll.
The row id.
The index of the row.
Gets the mode of a row.
The id of the row.
Returns "edit"
or "view"
.
Gets the full set of rows as [[Map<GridRowId, GridRowModel>]].
The full set of rows.
Gets the row node from the internal tree structure.
The id of the row.
The tree node.
Gets the [[GridRowParams]] object that is passed as argument in events.
The id of the row.
The row params.
Gets the total number of rows in the grid.
The number of rows.
Returns the row with the values that were set by editing the cells.
In row editing, field
is ignored and all fields are considered.
The row id being edited.
The field being edited.
The row with edited values.
Returns the row with the new value that was set by editing the cell.
The row id being edited.
The field being edited.
The data model of the row.
Returns the row with the values that were set by editing all cells.
The row id being edited.
The data model of the row.
Returns the current scroll position.
The scroll positions.
Returns an array of the selected rows.
A Map
with the selected rows.
Returns all row ids sorted according to the active sort model.
Returns all rows sorted according to the active sort model.
The sorted [[GridRowModel]] objects.
Returns the sort model currently applied to the grid.
The GridSortModel
.
Returns the amount of rows that are currently visible in the viewport
The amount of rows visible in the viewport
Returns the currently visible columns.
An array of [[GridStateColDef]].
Optional
headerThe React ref of the grid header filter row element.
Hides the column menu that is open.
Hides the filter panel.
Hides the header filter menu.
Hides the preferences panel.
Returns the value of the ignoreDiacritics
prop.
Controls if a cell is editable.
The cell params.
A boolean value determining if the cell is editable.
Returns which side a column is pinned to.
The column field to check.
Which side the column is pinned or false
if not pinned.
Determines if a row can be selected or not.
The id of the row.
A boolean indicating if the row can be selected.
Determines if a row is selected or not.
The id of the row.
A boolean indicating if the row is selected.
The React ref of the grid main container div element.
Moves the focus to the cell situated at the given direction. If field is the last and direction=right, the focus goes to the next row. If field is the first and direction=left, the focus goes to the previous row.
The base row id.
The base column field.
Which direction is the next cell to focus.
Observe row for 'auto' height changes.
The row element to observe.
The id of the row.
A dispose callback
Pins a column to the left or right side of the grid.
The column field to pin.
Which side to pin the column.
Emits an event.
Updates a control state that binds the model, the onChange prop, and the grid state together.
Register an applier.
The group of this applier
An unique and static identifier of the applier.
The applier to register.
A function to unregister the applier.
Register a processor and run all the appliers of the group.
The group on which this processor should be applied.
An unique and static identifier of the processor.
The processor to register.
A function to unregister the processor.
Registers a strategy processor. If the strategy is active, it emits an event to notify the agents to re-apply the processor.
A function to unregister the processor.
Imperatively run all the appliers of a group.
Most of the time, the applier should run because a processor is re-registered,
but sometimes we want to re-apply the processing even if the processor deps have not changed.
This may occur when the change requires a isDeepEqual
check.
The group to apply.
Reset the colspan cache
Resets the data source state.
Forces the recalculation of the heights of all rows.
Triggers a resize of the component and recalculation of width and height.
Inject the given values into the state of the DataGrid.
The exported state to restore.
Allows to access the root props outside of the React component.
Do not use in React components - use the useGridRootProps
hook instead.
Determines if the height of a row is "auto".
The id of the row.
True if the row height is "auto", false otherwise.
Immediately updates the value of the cell, without waiting for the debounce.
The row id.
Optional
field: stringThe field to update. If not passed, updates all fields in the given row id.
Triggers the viewport to scroll to the given positions (in pixels).
An object containing the left
or top
position to scroll.
Triggers the viewport to scroll to the cell at indexes given by params
.
Returns true
if the grid had to scroll to reach the target.
The indexes where the cell is.
Returns true
if the index was outside of the viewport and the grid had to scroll to reach the target.
Change the selection state of a row.
The id of the row.
Optional
isSelected: booleanPass false
to unselect a row. Default is true
.
Optional
resetSelection: booleanWhether to reset the already selected rows or not. Default is false
.
Change the selection state of all the selectable rows in a range.
Change the selection state of multiple rows.
The row ids.
Optional
isSelected: booleanThe new selection state. Default is true
.
Optional
resetSelection: booleanWhether to reset the already selected rows or not. Default is false
.
Updates the value of a cell being edited.
Don't call this method directly, prefer setEditCellValue
.
Object with the new value and id and field to update.
Resolves with true
when the new value is valid.
Sets the focus to the cell at the given id
and field
.
The row id.
The column field.
Sets the focus to the column group header at the given field
and given depth.
The column field.
The group depth.
Optional
event: MuiBaseEventThe event that triggers the action.
Sets the focus to the column header filter at the given field
.
The column field.
Optional
event: MuiBaseEventThe event that triggers the action.
Sets the focus to the column header at the given field
.
The column field.
Optional
event: MuiBaseEventThe event that triggers the action.
Moves a column from its original position to the position given by targetIndexPosition
.
The field name
The new position (0-based).
Changes the visibility of the column referred by field
.
The column to change visibility.
Pass true
to show the column, or false
to hide it. Default is false
Sets the column visibility model to the one given by model
.
The new visible columns model.
Updates the width of a column.
The column field.
The new width.
Sets the density of the grid.
Can be: "compact"
, "standard"
, "comfortable"
.
Sets the value of the edit cell. Commonly used inside the edit cell component.
Contains the id, field and value to set.
Optional
event: MuiBaseEventThe event to pass forward.
A promise with the validation status.
Changes which rows to expand the detail panel.
The ids of the rows to open the detail panel.
Changes the [[GridLogicOperator]] used to connect the filters.
The new logic operator. It can be: "and"
or "or
".
Sets the filter model to the one given by model
.
The new filter model.
Optional
reason: The reason for the model to have changed.
Sets the internal loading state.
If true
the loading indicator will be shown over the Data Grid.
Sets the displayed page to the value given by page
.
The new page number.
Sets the number of displayed rows to the value given by pageSize
.
The new number of displayed rows.
Sets the paginationMeta
to a new value.
The new pagination meta value.
Sets the paginationModel
to a new value.
The new model value.
Changes the pinned columns.
An object containing the columns to pin.
Set the quick filter values to the one given by values
The list of element to quick filter
Expand or collapse a row children.
the ID of the row to expand or collapse.
A boolean indicating if the row must be expanded or collapsed.
Sets the rowCount
to a new value.
The new row count value.
Updates the value of a cell being edited.
Don't call this method directly, prefer setEditCellValue
.
Object with the new value and id and field to update.
Resolves with true
when all values in the row are valid.
Moves a row from its original position to the position given by targetIndex
.
The row id
The new position (0-based).
Sets a new set of rows.
The new rows.
Sets the new row selection model.
⚠️ Caution: setRowSelectionModel
doesn't apply the selection propagation automatically.
Pass model returned by API method getPropagatedRowSelectionModel
instead to apply the selection propagation.
The new row selection model
Updates the sort model and triggers the sorting of rows.
The GridSortModel
to be applied.
Set a callback to know if a strategy is available.
The group for which we set strategy availability.
The name of the strategy.
A callback to know if this strategy is available.
Display the column menu under the field
column.
The column to display the menu.
Shows the filter panel. If targetColumnField
is given, a filter for this field is also added.
Optional
targetColumnField: stringThe column field to add a filter.
Optional
panelId: stringThe unique panel id
Optional
labelId: stringThe unique button id
Opens the header filter menu for the given field.
The field of the header filter to open menu for.
Displays the preferences panel. The newValue
argument controls the content of the panel.
The panel to open. Use "filters"
or "columns"
.
Optional
panelId: stringThe unique panel id
Optional
labelId: stringThe unique button id
Sorts a column.
The field identifier of the column to be sorted.
Optional
direction: GridSortDirectionThe direction to be sorted. By default, the next in the sortingOrder
prop.
Optional
allowMultipleSorting: booleanWhether to keep the existing [[GridSortItem]]. Default is false
.
Puts the cell corresponding to the given row id and field into edit mode.
The field of the header filter to put in edit mode.
Property that contains the whole state of the grid.
Stops the edit mode for the current field.
Stores the panel height measurement and triggers the row height pre-processing.
The id of the row.
The new height.
Registers a handler for an event.
The name of the event.
The handler to be called.
Optional
options: EventListenerOptionsAdditional options for this listener.
A function to unsubscribe from this event.
Toggles the column menu under the field
column.
The field name to toggle the column menu.
Expands or collapses the detail panel of a row.
The row id to toggle the panel.
Unpins a column.
The column field to unpin.
The data source API.
Replace a set of rows with new rows.
The index of the first row to be replaced.
The new rows.
Enable/disable column virtualization.
The enabled value for column virtualization
Changes the pinned rows.
Optional
pinnedRows: GridPinnedRowsProp<GridValidRowModel>An object containing the rows to pin.
Enable/disable virtualization.
The enabled value for virtualization
Updates the definition of multiple columns at the same time.
The new column [[GridColDef]] objects.
Updates a single sub-state.
Publishes the xxxChange
event and calls the onXXXChange
prop.
Which key of the state to update.
The new state of the sub-state to update.
Optional
reason: GridControlledStateReasonLookup[K]The reason to pass to the callback prop and event.
true
if the state has been successfully updated.
Recalculates the grid layout. This should be called when an operation has changed the size of the content of the grid.
Optional
updateUpdate grid rendering context.
The GridRenderContext
.
Allows to update, insert and delete rows.
An array of rows with an action
specifying what to do.
Allows to update, insert and delete rows at a specific nested level.
An array of rows with an action
specifying what to do.
Optional
groupKeys: string[]The group keys of the rows to update.
Updates or inserts a [[GridFilterItem]].
The filter to update.
Updates or inserts many [[GridFilterItem]].
The filters to update.
The React ref of the grid's horizontal virtual scrollbar container element.
The React ref of the grid's vertical virtual scrollbar container element.
The React ref of the grid's virtual scroller container element.
Puts the cell corresponding to the given row id and field into view mode and updates the original row with the new value stored.
If params.ignoreModifications
is true
it will discard the modifications made.
The row id and field of the cell to stop editing.
Puts the row corresponding to the given id and into view mode and updates the original row with the new values stored.
If params.ignoreModifications
is true
it will discard the modifications made.
The row id and field of the cell to stop editing.
The api of Data Grid Pro.