views:

30

answers:

2

I need to keep track of indexes/rows that are selected. When a row is selected in a jqGrid, I have an event splice an array - add if selected, remove if deselected.

Is this wise? I just have a "doesn't seem like a good idea" feeling, so I'm really just looking for some validation one way or another :).

+2  A: 

I can't think of a problem with it. A smart alternative might be to toggle a .selected class, then access the elements using $('.selected') when you need to.

Andy E
Hmm, I like that idea. I'd toggle a class, then when the dialog closes, get all the .selected rows. I may look into that, thanks Andy!
Dan
+2  A: 

it depends of what you need to do with that information. If you want to change the layout/styles of the rows the solution that Andy presented fits perfectly well. However if you need that indexes for data management you better use your method.

João Gala Louros