Selection Basics
The Angular Grid enables the user to select single or multiple cells and rows. It provides a rich API for customizing the selection logic and persisting the selected items based on specific requirements.
Setup
To enable the selection, configure the selectable option. It accepts both boolean and SelectableSettings parameters.
If you use a SelectableSettings parameter, the Kendo UI Grid for Angular enables you to specify the following options:
enabled—Determines if the selection is initially enabled. The default value istrue.checkboxOnly—Determines if the row selection is possible only when the user clicks a checkbox which utilizes theSelectionCheckboxDirective. The default value isfalse.mode—Sets theSelectableModeof the selection. The default value ismultiple.cell—Enables the cell selection. The default value isfalse.drag—Enables the drag selection. The default value isfalse.
The selection feature of the Grid applies only to the currently rendered items (items from the current page). For more information on how to modify this behavior, refer to the multiple selection with virtual scrolling or paging section.
The following articles cover common selection scenarios:
Toggling the Selection Functionality
To enable and disable the Grid selection functionality, bind the selectable option to a boolean value.
When the SelectionDirective is applied, it automatically enables the selection of the Grid component and you do not have to explicitly add the selectable option. However, you can still initially disable the selection and toggle it later by adding the selectable option as a SelectableSettings object. To disable the initial selection while keeping the toggle functionality, set the enabled property to false.
<kendo-grid ...
[selectable]="selectableSettings"
kendoGridSelectBy="ProductID"
[(selectedKeys)]="mySelection">
...
</kendo-grid>SelectionChange Event
When the user modifies the selection, the Grid emits the selectionChange event. It contains the following information:
selectedRows—A collection ofRowArgselements which represent the row items that were added to the selection (available in row selection mode).deselectedRows—A collection ofRowArgselements which represent the row items that were removed from the selection (available in row selection mode).selectedCells—A collection ofCellSelectionItemelements which represent the cells that were added to the selection (available in cell selection mode).deselectedCells—A collection ofCellSelectionItemelements which represent the cells that were removed from the selection (available in cell selection mode).ctrlKey—Abooleanvalue which represents the state of thectrlKeyduring the selection.selected—A deprecated property which represents the selected state of the affected row.index—A deprecated property which represents the index of the affected row.