Hi Team
I am using infragistics 2013.1 version grid and i am trying use rowselector feature and i am trying to select some rows and checked the checkbox from backend based on some data can you help me how we can do that.
i am giving you my sample code which i am trying to do but its not working
$("#prodByMeaInfra").on("iggriddatarendered", function (event, args) { $scope.$apply(function () { args.owner.element[0].rows[0].cells[0].innerHTML = "<span class=\"ui-state-default ui-corner-all ui-igcheckbox-normal\" name=\"hchk\" data-role=\"checkbox\" data-chk=\"on\"><span class=\"ui-icon ui-icon-check ui-igcheckbox-normal-on\"></span></span>"; }); });
or is there any way to keep the checked box state in same state at the time of using filter or sorting.
Please help me on this on urgent basis
Thanks
Vivek
Hi
Any help will be very helpful.
Hello Vivek,
RowSelectors checkboxes are checked when their row is selected. You can use Selection's API to select rows. Please refer to the Selection documentation for more information .
Preserving Selection through Filtering and Sorting will require some event handling. You'll need to bind to e.g. dataFiltering and dataFiltered events. In the dataFiltering event handler you'll need to get the currently selected rows and store their IDs (the solution will require that a primaryKey is set for the grid). In the dataFiltered event handler you'll reapply the stored selection state with the Selection API.
I am attaching a sample demonstrating this approach. It only has Filtering enabled but preserving the selected rows after sorting should be similar.
I hope this helps! Please, let me know if you have any additional questions or if you need help implementing the solution with Sorting enabled.
Best regards,
Stamen Stoychev
Thanks Stamen
the solution provide by you is worked for me but instead of using different event handler i used gridrerender event for both sorting and filtering something like that.
checkBoxStateChanged: function (evt, ui) { $scope.eventRowSelectors(evt,ui) }
$("#prodByMeaInfra").on("iggriddatarendered", function (event, args) { for (i = 0; i < selectedRowsIds.length; i++) { $("#prodByMeaInfra").igGridSelection("selectRow", $("#prodByMeaInfra").find("tr[data-id='" + selectedRowsIds[i] + "']").index()); } });
$scope.eventRowSelectors = function (event, ui) { selectedRowsIds = []; var selectedRows = $("#prodByMeaInfra").igGridSelection("selectedRows"), i; for (i = 0; i < selectedRows.length; i++) { selectedRowsIds.push(selectedRows[i].element.attr("data-id")); }
}
Thanks again
Your solution looks great! Good luck with your project!
Thanks stamen
sorry to disturb you once again actually i am trying row summaries and our client want something like for one column total and one column for average.
even i tried that and i am able to get that there is one problem one that i am getting total on one row and and average on one row, my question is is there any possibilities to make both summaries in one row for your reference i am attaching one screen shot in post.
Please help me on this.
Its worked perfectly for me.
This should be controlled by the compactRenderingMode option of Summaries. However, it is true by default and the single summary for each row should be shown on the same line. Could you please check if changing it to true or 'auto' makes a difference? If it doesn't it could be an issue in the control itself which will have to be logged and resolved with a service release.