简体   繁体   中英

Get page of selected item in kendo grid

I have a kendo grid where I preselect one item that can be on any page. In many cases, my default selected item is not on page one (which is usually the first page you see), so the selected item is hidden. I need to get the page number of the data item. How can I do this? Is there a function that I've not seen yet from kendo?

As far as I remember, you can do something like that:

var index = dataSource.indexOf(item) + 1; // find where item is in data source

var pageSize = dataSource.pageSize(); // find how many items per page

var currentPage = Math.ceil(index/pageSize); // find at which page item is

dataSource.query({ page: currentPage, pageSize: dataSource.pageSize() }); // go to that page

.pageSize() , .query()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM