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
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.
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!
Best regards,
Stamen Stoychev
Hello Olivier,
Please take a look at the other thread about the issue you are experiencing. The solution in this thread was aimed at providing a way to check checkboxes in the 11.2 version, in which checkbox and regular selection were detached from each other and the Selection API was not able to alter the checkbox states. This is no longer valid in later versions (12.1+).
Thank you for using Infragistics forums!
Hello Stamen,
The idea of using $ ("# Grid tbody th> span [data-role = 'checkbox']: eq (" + rowIndex + ")"). Trigger ("click") is good. However in my case I do not know when I have to initialize checked rows.I used the event "pagerRendering" to check the rows but at the unchecked the row stay active.. What event should I use? I am looking for the equivalent of a redraw event.
Regards,Olivier
Yes basically my situation is this:
- I have row selectors with checkboxes, although that is not the only trigger for edit.
- I really have one cell that is editable, if you double click on that cell ("AmountToPay") - the grid will enter edit mode
- I also have custom summaries on the page which I was able to do, in addition to the built-in "SUM" functions of "TotalDue" and "AmountToPay", I have a custom summary that shows "SelectedAmountToPay".
My user experience requirement is this:
- When a user edits an item, after they finish editing, the row they edited should remain selected because that custom summary will reflect how much they have have decided to pay.
I am pretty much close to all my requirements but I cannot get the row to select again so the custom summary can fire after edit is complete.
Hi again,
Sorry I think I misunderstood you. If you wish to retain the selection when a row goes into edit mode and you do the selection only through the checkboxes, you can try the following:
$("#Grid").live("iggridselectionrowselectionchanging", function () { return false; });
instead of your current event handler. However in this case you will no longer be able to select rows by clicking on them, this will only activate them. Rows will only be selectable through the checkboxes. If this is unacceptable, please let me know and I'll try to provide you with a better solution!
Hi, I tried this, but it still doesn't select. Is there some other property I need to set?
Here are my Selection settings:
features.RowSelectors().EnableRowNumbering(false).EnableCheckBoxes(true); features.Selection() .Mode(SelectionMode.Row) .MultipleSelection(true);
Here are my Edit Settings:
features.Updating() .EnableAddRow(false) .EnableDeleteRow(false) .EditMode(GridEditMode.Row) .StartEditTriggers(GridStartEditTriggers.Click)
Here is my event handler:
$(document).live("#Grid", "iggridupdatingeditrowended", function(evt, ui) { var rowIndex = $('#Grid > tbody > tr').index($("[data-id='" + ui.rowID + "']")); $('#Grid').igGridSelection('selectRow', rowIndex); $("#Grid tbody th>span[data-role='checkbox']:eq(" + rowIndex + ")").trigger("click"); });
After a row is edited, and I click "Done", it doesn't keep the selection