Reputation: 11
I am trying to get the first row of the angular kendo grid selected by default when the grid loads. Any suggestions ?
Upvotes: 1
Views: 4737
Reputation: 487
You have to setup the [kendoGridSelectBy]
and [selectedKeys]
properties to do this.
Pay attention - the [selectedKeys]
property not works without [kendoGridSelectBy]
and it throw an error Can't bind to 'selectedKeys' since it isn't a known property of 'kendo-grid'
.
Read https://www.telerik.com/kendo-angular-ui/components/grid/selection/#toc-persisting-the-selection for more information.
Upvotes: 10
Reputation: 1272
You can use the selection persisting function of the grid.
In your ts code add something like that:
private mySelection: number[] = [0];
In the html add that:
<kendo-grid [selectedKeys]="mySelection"
Upvotes: 0