I have jqGrid 3.5 (full) mostly working. I have it retrieving data with the multi-select option on. The one part I can not get to work is getting the selected rows. The docs state:
To obtain selected rows we can use getGridParam('selarrrow') method. Using our example we can write this:
jQuery("#grid_id").getGridParam('selarrrow');
which will return an array with the selected rows (i.e., ["11","9"] from the figure above). The values in array are the id's of the selected rows.
This does not work and returns an undefined value (yes I have rows selected). I also have xmlreader:id setup in my grid config.
Can someone point me to a direction to look? I have tried everything I can think of to no avail.
UPDATE: redsquare was correct about incorrect selectors. my containing div had the same ID as the grid, I noticed this when I went to check my setup code and the selector was table#results
changed that and it all works. Thanks all. If you post an answer redsquare I will accept it as it is the correct answer.
This will also give the row details and using normal . operator you can get column value.
Another way to get the selected rows:
jQuery('#grid').jqGrid('getGridParam','selarrrow');
You have to refer not to jQuery object, but to jqGrid itseft.
So, during initialization of grid, you write the code like:
And in your event handler, if you want to retrieve the IDs of the selected rows, you have to write:
Try this, It will return an array of selected rows' id.
Can you check the selectors for me first. if they are correct can you try to upload your page or replicate the issue at jsbin.com. :)