I would like to get the global index of a given Kendo Grid row to implement multi-selection on a grid with virtual scroll ability .
It is easy to get the index in the displayed lines:
var kendoGrid = $("#myGrid").data("kendoGrid");
var index = kendoGrid.items().index(kendoGrid.select());
At this point, the logic would be to use the page number / page size to determine what is the global index of the selected row.
index += (kendoGrid.dataSource.page() - 1) * kendoGrid.dataSource.pageSize();
However, this does not work with the Kendo grid (except for the first page), since the grid displays lines from a previously loaded page.
Example:
You have records from 1 to 200 with page size 100. When you go to record No. 100, a dataBound grid event will occur and you will notice that the dataSource page has changed from 1 to 2.
, 1 , 2.
, β 96 95, 1. 2, # 96 ( ). , , 0. / , 100.
- , , ?
PK, , PK, .