Row Selection

Learn how to implementing Row Selection with the Server-side Row Model.

Selection with Server-side Row Model

Selecting rows and groups in the Server-side Row Model is supported. Just set the property rowSelection to either single or multiple as with any other row model.

Selecting Group Nodes

When you select a group, the children of that group may or may not be loaded into the grid. For this reason the setting groupSelectsChildren=true (which selects all the children of the group when you select a group) does not make sense. When you select a group, the group row only will be marked as selected.

Example - Click Selection

The example below shows both simple 'click' selection as well as multiple 'shift-click' selections. Selecting groups is not allowed as clicking on groups is reserved for opening and closing the groups.

  • Single 'Click' Selection - when you click on a leaf level row, the row is selected.
  • Multiple 'Shift-Click' Selections - select a leaf row (single click) and then 'shift-click' another leaf row within the same group to select all rows between that range.
Performing multiple row selections using 'shift-click' has the following restrictions:
  • Only works across rows that share the same parent.
  • Only works for rows that are loaded (eg a large range selection may span rows that are not loaded).

Example - Checkbox Selection

Below shows another example using checkbox selection. The example shows: The example shows checkboxes on the groups and a regular column. This is for comparison in the example only. Normal applications generally have the checkbox on one column or the groups.

  • Checkbox selection on the group column allowing selection of any row.
  • Checkbox selection on the group sport column. Selection is restricted to leaf level rows only via gridOptions.isRowSelectable(rowNode) callback.

Providing Node ID's

Providing node ID's is optional. If you provide your own node id's (using the getRowNodeId() callback) then you must make sure that the rows have unique ID's across your entire data set. This means all the groups and all leaf level nodes must have unique id's, even if the leafs are not part of the same group. This is because the grid uses node id's internally and requires them to be unique.

If you do not provide node id's, the grid will provide the id's for you, and will make sure they are unique.

Next Up

Continue to the next section to learn about setting Row Heights using the Server-side Row Model.