I'm using this method igGridSelection('selectedRows') to get the selected rows, but it does not return all the selected rows when using the grid's paging feature. It looks like it only returns the selectedRows for the current page. I'm using the EnableCheckBoxes feature to display a checkbox on the row, and I would like to get all the rows with the checkbox checked on all the pages.
Thanks
Hello Martin,
Thank you for very much for the response. I looked at the solution, it will work for me.
I appreciate your help.
Regards,
Rajesh
Hello Rajesh,
The functionality which you want will be available officially as part of the product in the IgniteUI 14.1 volume release. For IgniteUI 13.2 and earlier you can use a custom solution demonstrated in the sample attached to this forum post.
Note: The technique demonstrated in the sample for persisting selection works for Paging, Sorting and Filtering features.
Best regards,Martin PavlovInfragistics, Inc.
hi,
How to persist row selection with sorting?
I tried to use similar technique as explained in this thread but rows selected across features are different as the index changes after sorting.
How to solve this problem?
Thanks,
Hello guys,
There is no specified Razor syntax to implement this approach. It is needed the events to be handled by javascript functions:
<script type="text/javascript">
var selectedProducts = [];
$(document).delegate("#grid1", "iggridselectionrowselectionchanged", function (evt, ui) {
var tmpPage = $("#grid1").igGridPaging("pageIndex");
var selectedProductshelper = $("#grid1").igGridSelection("selectedRows");
selectedProducts[tmpPage] = selectedProductshelper;
});
$(document).delegate("#grid1", "iggridpagingpageindexchanged", function (evt, ui) {
if (selectedProducts[tmpPage]) {
var l = selectedProducts[tmpPage].length;
for (var i = 0; i < l; i++) {
var r = selectedProducts[tmpPage][i].index;
$("#grid1").igGridSelection("selectRow", r);
}
else return;
})
</script>
The solution above collects the selected items in a matrix. Each array from it corresponds to a grid page. Since index numbers duplicates on different pages each row is defined both by its index number and the page number it is positioned on.
I have also attached the whole MVC project for you reference.
Hope this will help. If any further questions or concerns arise feel free to contact me again.
I'm having the same issue, however, I'm using MVC Razor. Can you please provide this solution in Razor syntax? Thanks.