I want to fetch a selected data from all the pages.
For example I select 1 item from the page 1 and the 2nd item from the page 2. When I click on the button (Get Checked Rows). I want to fetch those id's that I just selected from the different pages.
So far this is what I found, but it works for a single pages only. FULL DEMO
var grid = $("#grid").data("kendoGrid");
var selectedRows = grid.select();
selectedRows.each(function(index, row) {
var selectedItem = grid.dataItem(row);
alert(selectedItem.ProductID);
});
Is there any other way, instead creating a template/id for a checkbox.
You need to use the selectedKeyNames method rather than the select method.
If you update your code like this (updated DEMO), you can see it work:
$("#button").kendoButton({
click: function(e){
var grid = $("#grid").data("kendoGrid");
var selectedRows = grid.select();
//show all selected keys across all pages
alert(grid.selectedKeyNames());
selectedRows.each(function(index, row) {
var selectedItem = grid.dataItem(row);
alert(selectedItem.ProductID + ' | ' + selectedItem.ProductName);
});
}
});
More info and a Telerik example can be found here: https://docs.telerik.com/kendo-ui/knowledge-base/checkbox-selection-dataitems-selected-rows