Selecting rows and groups in the Server-Side Row Model is supported. Configure the selection
grid option as described in Row selection. Some SSRM-specific considerations are detailed below.
Server-Side Row Selection requires Row IDs to be supplied to grid.
Filters and Selection Copy LinkThe selected rows are preserved when the grid is sorted or filtered and are displayed as selected when scrolled into view. Select a row, apply a column filter so that the selected row is in the filter results and it will appear as selected in the filter results. If a selected row doesnât match the applied filter, it will still be selected when the filter is removed.
Selecting All Rows Copy LinkWhen using SSRM, the 'filtered'
or 'currentPage'
settings for rowSelection.selectAll
are considered invalid. The grid will behave as though rowSelection.selectAll = 'all'
, which is the default value. The example below demonstrates this.
When using header checkbox selection with the server-side row model, you should not use the api functions getSelectedNodes()
or getSelectedRows()
. See the API Reference section below for suggested alternatives.
When using group selection with the server-side row model, you should not use the api functions getSelectedNodes()
or getSelectedRows()
. See the API Reference section below for suggested alternatives.
When adding a new row via transaction, the new row will be treated as if it conforms to its parent's selection. Therefore, if the parent row was selected the new row will be treated as selected upon creation. For indeterminate groups, this will follow the last non-indeterminate state. Note the following:
Add new Aggressive
button, the new row is unselectedAggressive
group, new rows created by the Add new Aggressive
button will be selected.Aggressive
group, new rows follow the group's previous selection state.The following API functions exist for the Server-Side Row Model when using Row Selection. These can be used to get the currently selected rows and nodes if all of the selected rows have been loaded by the grid. These cannot be used while using rowSelection.groupSelects
is 'descendants'
or 'filteredDescendants'
, or when any select all functionality is required.
Function
Returns an unsorted list of selected nodes. Getting the underlying node (rather than the data) is useful when working with tree / aggregated data, as the node can be traversed.
RowSelectionModuleFunction
Returns an unsorted list of selected rows (i.e. row data that you provided).
RowSelectionModuleWhen using selection where all selected rows may not have been loaded, it is instead advised to use api.getServerSideSelectionState
and api.setServerSideSelectionState
, as these functions can be used to identify selected rows without having ever loaded the rows.
Function
Returns an object containing rules matching the selected rows in the SSRM. If rowSelection.groupSelects
is 'self'
the returned object will be flat, and will conform to IServerSideSelectionState
. If rowSelection.groupSelects
is 'descendants'
or 'filteredDescendants'
the returned object will be hierarchical, and will conform to IServerSideGroupSelectionState
.
Function
Set the rules matching the selected rows in the SSRM. If rowSelection.groupSelects
is 'self'
the param will be flat, and should conform to IServerSideSelectionState
. If rowSelection.groupSelects
is 'descendants'
or 'filteredDescendants'
the param will be hierarchical, and should conform to IServerSideGroupSelectionState
.
The below snippet demonstrates how to set all nodes as selected, except for the row which has the ID group-country-year-United States
, and the row with the ID group-country-year-United States2004
.
api.setServerSideSelectionState({
selectAll: true,
toggledNodes: ['group-country-year-United States', 'group-country-year-United States2004'],
});
In the example below, note the following;
firstDataRendered
callback, which sets the initial selection state.Save Selection
button has been configured to store the result of api.getServerSideSelectionState()
, it also logs the saved state to the console when clicked.Load Selection
button can subsequently re-apply the previously saved selection rules using api.setServerSideSelectionState(state)
.The below snippet demonstrates how to set all nodes as selected, except in the case of the "United States" group, whose only selected child is the row with the ID group-country-year-United States2004
.
params.api.setServerSideSelectionState({
selectAllChildren: true,
toggledNodes: [{
nodeId: 'group-country-year-United States',
selectAllChildren: false,
toggledNodes: [{
nodeId: 'group-country-year-United States2004',
selectAllChildren: true,
}],
}],
});
The state being used here conforms to IServerSideGroupSelectionState
, not IServerSideSelectionState
. Invalid states will be ignored.
In the example below, note the following;
firstDataRendered
callback, which sets the initial selection state.Save Selection
button has been configured to store the result of api.getServerSideSelectionState()
, it also logs the saved state to the console when clicked.Load Selection
button can subsequently re-apply the previously saved selection rules using api.setServerSideSelectionState(state)
.Row selection is also supported when using tree data. See this documented on the SSRM Tree Data page.
Next Up Copy LinkContinue to the next section to learn how to configure the Loading Cell Renderer.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4