How to work with Webix Grid select modes.
In DataGrid, you can specify different types of selection depending on your needs.
Available modes are:
- cell;
- row;
- column;
- multi cell;
- multi row;
- multi column;
- block selection;
- area selection.
The desired type is set through parameters select, multiselect, blockselect, and areaselect.
The table below shows which combination of parameters you should use for each type.
| Type of selection | Related parameters |
|---|---|
| single cell |
|
For example, to set in your DataGrid multi row selection, you should use the following code:
// Enabling multi row selectionwebix.grid({ select:"row", multiselect:true});you can check the full snippet Multi-Row Selection
Related Methods
Section titled “Related Methods”| Method | Description |
|---|---|
| [clearSelection](/docs/api/datagrid-clearselection) | clears selection |
| [getSelectedId](/docs/api/datagrid-getselectedid) | returns the selected cells |
| [mapSelection](/docs/api/datagrid-mapselection) | executes some custom method for all cells in the currently selected block |
| [moveSelection](/docs/api/datagrid-moveselection) | moves selection to the specified direction |
| [select](/docs/api/datagrid-select) | selects the specified element |
| [selectRange](/docs/api/datagrid-selectrange) | selects the specified range of elements |
| [unselect](/docs/api/datagrid-unselect) | cancels selection of the specified element |
Related Events
Section titled “Related Events”| Event | Description |
|---|---|
| [onAfterSelect](/docs/api/datagrid-onafterselect-event) | fired after a cell is selected |
| [onAfterUnSelect](/docs/api/datagrid-onafterunselect-event) | fired after a cell is unselected |
| [onBeforeSelect](/docs/api/datagrid-onbeforeselect-event) | fired before a cell is selected |
| [onBeforeUnSelect](/docs/api/datagrid-onbeforeunselect-event) | fired before a cell is unselected |
| [onSelectChange](/docs/api/datagrid-onselectchange-event) | fired when selection is changed in DataGrid |