Applies the current sort model to the rows.
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
Deletes a [[GridFilterItem]].
The filter to delete.
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.
Forces the grid to rerender. It's often used after a state update.
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.
Gets the value of a cell at the given id
and field
.
Returns the [[GridColDef]] for the given field
.
The column field.
The [[GridStateColDef]].
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.
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 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.
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 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 currently visible columns.
An array of [[GridStateColDef]].
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.
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.
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.
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
.
Sets the focus to the cell at the given id
and field
.
The row id.
The column field.
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.
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.
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.
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.
Allows to update, insert and delete rows.
An array of rows with an action
specifying what to do.
Updates or inserts a [[GridFilterItem]].
The filter to update.
Updates or inserts many [[GridFilterItem]].
The filters to update.
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.