Server-Side Row Selection

Learn how to implement 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, only the group row 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 (e.g. a large range selection may span rows that are not loaded).

Example: Checkbox Selection

Below shows another example using checkbox selection. 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 IDs

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

If you do not provide node IDs, the grid will generate the IDs for you, and will make sure they are unique.

Next Up

Continue to the next section to learn about setting Row Height using the Server-Side Row Model.