Row selection in TypeScript Treegrid control

18 Nov 20181 minute to read

Select row at initial rendering

To select a row at initial rendering, set the selectedRowIndex value.

Get selected row indexes

You can get the selected row indexes by using the getSelectedRowIndexes method.

Multiple selection based on condition

You can select multiple treegrid rows based on condition by using the selectRows method.

In the following code, the rows which contains taskID value as 3 and 5 are selected at initial rendering.

Toggle selection

The Toggle selection allows to perform selection and unselection of the particular row or cell. To enable toggle selection, set enableToggle property of the selectionSettings as true. If you click on the selected row or cell then it will be unselected and vice versa.

If multi selection is enabled, then first click on any selected row (without pressing Ctrl key), it will clear the multi selection and in second click on the same row, it will be unselected.