Saving selected rows in jqGrid during swap

I have jqGrid with which users will select records. On multiple pages, you can select a large number of entries.

The selected rows seem to be cleared when user pages pass data. Can a developer manually track selected rows in an array? I do it fine, but I'm not sure which is the best way. I'm not sure I want to splic an array whenever any number of records are selected, as it looks like this can really slow things down.

My ultimate goal is to have a jQueryUI dialog box that, when closed, stores all selected rows so that I can send it to the server.

Insight, questions, comments; all are appreciated!

Note: the aspnetmvc tag is added only because it is intended for MVC application

+4
source share
3 answers

Yes, the developer must track this selection manually. However, you do not need to use an array; You can use any data structure that you like.

+1
source

I would load every line when selecting $ in the container . data () . Thus, you can save them away from the grid, and when the user makes a choice, you will have a good batch data set that you can work with.

+1
source

I had a similar requirement, and I came across this post. I decided to share my solution:

var selId; $("#grid").jqGrid({ ... onSelectRow: function(id){ selId = id; }, gridComplete: function() { $("#grid").setSelection(selId, true); }, ... }); 

It was just for one choice, but it could be easily adapted to many choices by making an selId array.

+1
source

Source: https://habr.com/ru/post/1307544/


All Articles