A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.ag-grid.com/javascript-data-grid/server-side-model-selection/ below:

JavaScript Grid: SSRM Row Selection

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 Link

The 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 Link

When 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.

Group Selection Copy Link

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.

Transactions Copy Link

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:

API Reference Copy Link

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.

RowSelectionModule

Function

Returns an unsorted list of selected rows (i.e. row data that you provided).

RowSelectionModule

When 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.

ServerSideRowModelApiModule

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.

ServerSideRowModelApiModule Selection API Copy Link

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;

Group Selection API Copy Link

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;

Tree Data Copy Link

Row selection is also supported when using tree data. See this documented on the SSRM Tree Data page.

Next Up Copy Link

Continue 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