views:

197

answers:

2

I have a jqGrid with which users will select records. A large number of records could be selected across multiple pages.

The selected rows seem to get cleared out when the user pages through the data. Is it up to the developer to manually track the selected rows in an array? I'm fine doing this, but I'm not sure what the best way is. I'm not sure I want to be splicing an array whenever any number of records are selected as that seems like it could really slow things down.

My end goal is to have a jQueryUI dialog that, when closed, while store all the selected rows so I can post it to the server.

Insight, questions, comments; all are appreciated!

Note: added aspnetmvc tag only because this is for an MVC app

+1  A: 

Yes, it's up to the developer to track this selection manually. You don't have to use an array, though; you can use any data structure you like.

Craig Stuntz
I was thinking an array may be easier in terms of removing data when a user de-selected. I planned on using `onSelectRow`. I'll admit I'm no veteran JS developer, however :)
Dan
+1  A: 

I would load each row when selected into the $.data() container. This way you can store them away from the grid and when the user is done selecting have a nice packaged data set you can then work with.

Jeremy B.
This seems to deal with DOM elements. Really, all I need is a list of IDs. I'd then parse the IDs and inject them into the DOM/Form as hidden fields. Still, worth looking into - thanks!
Dan