user2386447
user2386447

Reputation: 11

Angular 4 Kendo UI Grid first row selected by default when grid loads

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

Answers (2)

Artem
Artem

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

Ludwig
Ludwig

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

Related Questions