The selection API interface that is available in the grid [[apiRef]].

interface GridRowSelectionApi {
    getSelectedRows: (() => Map<GridRowId, GridValidRowModel>);
    isRowSelectable: ((id: GridRowId) => boolean);
    isRowSelected: ((id: GridRowId) => boolean);
    selectRow: ((id: GridRowId, isSelected?: boolean, resetSelection?: boolean) => void);
    setRowSelectionModel: ((rowSelectionModel: GridRowSelectionModel) => void);
}

Hierarchy (view full)

Properties

getSelectedRows: (() => Map<GridRowId, GridValidRowModel>)

Returns an array of the selected rows.

Type declaration

isRowSelectable: ((id: GridRowId) => boolean)

Determines if a row can be selected or not.

Type declaration

    • (id): boolean
    • Parameters

      Returns boolean

      A boolean indicating if the row can be selected.

isRowSelected: ((id: GridRowId) => boolean)

Determines if a row is selected or not.

Type declaration

    • (id): boolean
    • Parameters

      Returns boolean

      A boolean indicating if the row is selected.

selectRow: ((id: GridRowId, isSelected?: boolean, resetSelection?: boolean) => void)

Change the selection state of a row.

Type declaration

    • (id, isSelected?, resetSelection?): void
    • Parameters

      • id: GridRowId

        The id of the row.

      • OptionalisSelected: boolean

        Pass false to unselect a row. Default is true.

      • OptionalresetSelection: boolean

        Whether to reset the already selected rows or not. Default is false.

      Returns void

setRowSelectionModel: ((rowSelectionModel: GridRowSelectionModel) => void)

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.

Type declaration

    • (rowSelectionModel): void
    • Parameters

      Returns void