I have an igGrid (using v2012.2) with the selection feature enabled. It is displayed in a jQUery dialog. I am getting incorrect behavior when I try to get the selected rows and when I try to clear the selected rows. I've created and attached a sample that demonstrates the problem (in Chrome and IE).
Problem 1 - I want to get the selected rows:
I have an event handler for the rowSelectionChanged. Run my sample and select two rows (you have to select at least two to see issue, one doesn't display the issue). Notice that with two rows selected, if I do a
var rows = args.selectedRows; alert("From args - rows.length: " + rows.length);
I get 2 as expected. However, if I do a
rows = $('#grid').igGridSelection('selectedRows'); alert("From igGridSelection - rows.length: " + rows.length);
I get 1 always. No matter how many rows I've selected. Finally, if I do (NOTE: using igGrid instead of igGridSelection) a
rows = $('#grid').igGrid('selectedRows'); alert("From igGrid - rows.length: " + rows.length);
I again get the correct 2. All your samples show using igGridSelection. I don't understand the differnence or why to use igGridSelection vs igGrid and why the inconsistent results.
Problem 2 - I want to clear the selected rows:
Start with two rows selected in my sample. Click the 'Clear Selection' button. Again (as in problem #1) I have to use the igGrid to get the selected row array. I then use, as described in your docs, $('#grid').igGridSelection('clearSelection'); to try to clear the grid. It doesn't work. I tried using igGrid instead of igGridSelection with same result. Why isn't grid selection clearing?
Important note: if the grid is not displayed in jQuery dialog, all is ok.
Thanks,
Pat
Hello Pat,
If you have any other questions, please feel free to contact us.
Thanks Martin, that works.
I guess I should RTFM!
Cheers,
Hi Pat,
There is a known issue that the grid API doesn't work well when grid container is DIV. This is described in Known Issues and Limitations document. You should change the grid placeholder to be TABLE element and everything should work as expected.
Best regards,
Martin Pavlov
Infragistics, Inc.