How To Maintain The Old Page Number In The Kendo Grid When The Grid Rebinds?

Generally, When we perform any operation on a particular row on any page and after that operation, we are rebinding the grid when it moves us to the 1st page.

It’s become very frustrating when we have a number of pages.

In this article, I’m gonna explain, how can we maintain the old selected page numbers when we rebind the grid. So, let’s start it.

If your Grid is server-side:

Most people bind the grid again to refresh data. If your grid is server-side then you just need to write one line when you rebind the grid. It will fetch the data the same as the old state of the grid.

$("#myGrid").data("kendoGrid").dataSource.read();

If your Grid is client-side:

If your grid is client-side then you need to keep watch and save the old selected page number. Using the page change events, we can track the page number selection, and using the below line we can change the page of the grid. “oldPageNumber” is a variable, which contains the old selected page number.

$("#myGrid").data("kendoGrid").dataSource.page(oldPageNumber);

 

 

 

 

Submit a Comment

Your email address will not be published. Required fields are marked *

Subscribe

Select Categories