Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
405
igGrid with feature selection not returning selected rows or clearing selected rows
posted

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

TestMultiSelect.zip