GridSelection
Mixin
A mixin for Grid that handles row and cell selection. See selectionMode for details on how to control what should be selected (rows, cells, columns) and how the selection should work.
const grid = new Grid({ height : 300, appendTo : targetElement, selectionMode : { row : true, checkbox : { region : 'locked' }, showCheckAll : true }, columns : [ { text : 'Id', field : 'id' }, { text : 'First name', field : 'firstName', width : 150 }, { text : 'Surname', field : 'surName', width : 150 } ], data : DataGenerator.generateData(10) }); grid.selectedRecords = [1, 2, 3]; // select a row
grid.selectedRow = 7;
// select a cell
grid.selectedCell = { id: 5, columnId: 'column1' }
// select a record
grid.selectedRecord = grid.store.last;
// select multiple records by ids
grid.selectedRecords = [1, 2, 4, 6]
See also
- Grid - The Grid widget
- GridNavigation - Cell navigation mixin
Configs
Configs are options you supply in a configuration object when creating an instance of this classProperties
Properties are getters/setters or publicly accessible variables on this class-
Identifies an object as an instance of GridSelection class, or subclass thereof.
-
Identifies an object as an instance of GridSelection class, or subclass thereof.
-
In cell selection mode, this will get the cell selector for the (last) selected cell. Set to an available cell selector to select only that cell. Or use selectCell() instead.
-
CSS selector for the currently selected cell. Format is "[data-index=index] [data-column-id=column]".
-
In cell selection mode, this will get the cell selectors for all selected cells. Set to an array of available cell selectors. Or use selectCells() instead.
-
The last selected record. Set to select a row or use Grid#selectRow. Set to null to deselect all
Functions
Functions are methods available for calling on the class-
getRange( )private
Used internally to get a range of cell selectors from a start selector to an end selector.
-
onStoreDataChange( )private
Triggered from Grid view when the store changes. This might happen if store events are batched and then resumed. Deselects all records which have been removed.
-
onStoreRecordIdChange( )private
Triggered from Grid view when the id of a record has changed. Update the collection indices.
-
onStoreRemove( )private
Triggered from Grid view when records get removed from the store. Deselects all records which have been removed.
-
onStoreRemoveAll( )private
Triggered from Grid view when all records get removed from the store. Deselects all records.
-
selectAll( )NON-LAZY-LOAD
This selects all rows. If store is filtered, this will merge the selection of all visible rows with any selection made prior to filtering.