I would like to send from the server what checkboxes should appear checked when initializing the grid?
I've seen the there are Selection methods to set the selected rows, but I've not found any method for the RowSelector checkboxes.
How can I do it?
Thanks
Hi Qnal,
You are doing it correctly, however there is an issue that prevents checkboxes from being checked when a row is being selected through the selectRow method of the Selection feature. We should have it resolved in the future builds.
You can work around it by doing the selection the other way around - invoking click on the checkbox which will in turn select the row as well. In your example it would equal replacing the
$("#Grid").igGridSelection("selectRow", rowIndex);
with
$("#Grid tbody th>span[data-role='checkbox']:eq(" + rowIndex + ")").trigger("click");
Hope this helps!
Best regards,
Stamen Stoychev
We have 2012 V1 and the following doesn't seem to work unless I'm doing something wrong:
After a row is edited, I'm trying to retain selection - which is done via a checkbox selector - I'm doing this by handling the iggridupdatingeditrowended function but it doesn't appear to work...?
$(document).delegate("#Grid", "iggridupdatingeditrowended", function(evt, ui) { var rowIndex = $("#Grid > tbody > tr").index($("[data-id='" + ui.rowID + "']")); $("#Grid").igGridSelection("selectRow", rowIndex); });
Hello Idwedari,
You are correct, there is no public API for achieving this. There are a few ways to simulate checking the checkboxes on the client which you can use as a workaround:
Selecting the specific checkbox and triggering a click event on it using jQuery. For example:
$("#grid1 span.ui-igcheckbox-normal:eq(" + checkboxIndex + ")>span").trigger("click");
The other way is to use a private function that requires the checkbox object itself.
var checkbox = $("#grid1 span.ui-igcheckbox-normal:eq(" + checkboxIndex + ")");
$("#grid1").data("igGridRowSelectors")._handleCheck(checkbox);
With the 2012 Volume 1 release which is coming soon, you will no longer need this additional code because the RowSelectors checkboxes will get checked by simply calling the selectRow method from the Selection feature. This change in the behavior was implemented mainly due to use cases similar to yours.
Thank you for using the Infragistics forums and hope this will help you resolve your issue!
Any answer on this? Is it possible to set the checked boxes in the RowSelector from the javascript code?
I really need to know this so that we can decide if igGrid is the right component for our web project.