kendo grid angular selecting the first row programmatically on page change

1 Answer 673 Views
Grid
Jyothi
Top achievements
Rank 1
Iron
Iron
Veteran
Jyothi asked on 24 Aug 2022, 11:48 AM

Hi,

Is there a way to select the first row when we move from one page to another in kendo grid angular.

We have a requirement where we show some details of the data when a row is selected. IT is easy to do when the first time the grid is loaded. But when we move to another page using pagination functionality, no row is selected (grid default behavior). 

How do we select the first row when we move from one page to another programmatically?

Regards,

Jyothi

1 Answer, 1 is accepted

Sort by
0
Hetali
Telerik team
answered on 26 Aug 2022, 04:34 PM

Hi Jyothi,

In order to select the first row when moving pages in the Kendo UI Grid, use the pageChange event to update the selectedKeys. For example:

<kendo-grid 
  kendoGridSelectBy="ProductID"
  [(selectedKeys)]="mySelection"
>
</kendo-grid>

public pageChange(event: PageChangeEvent): void {
  this.mySelection = [event.skip + 1]
  this.skip = event.skip;
  this.loadItems();
}

I have demonstrated the above discussed method in this StackBlitz example.

Please let me know if this solution helps or if I can further assist you.

Regards,
Hetali
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Grid
Asked by
Jyothi
Top achievements
Rank 1
Iron
Iron
Veteran
Answers by
Hetali
Telerik team
Share this question
or