tags:

views:

5155

answers:

2

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.

+5  A: 

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. :)

redsquare
That was exactly the problem. I had a div with the same ID as my grid.
Andrew Burns
A: 

You have to refer not to jQuery object, but to jqGrid itseft.

So, during initialization of grid you write the code like

var myGrid = $("#list")..jqGrid(....);

And in your event handler, or whatever you want to retrieve ids of the selected rows you have to write:

myGrid .getGridParam('selarrrow');

Hopes this helps...

Leonard