JQGrid update multiple rows at once then save

2019-05-19 07:54发布

问题:

I have a requirement to be able to update 'n' number of rows in one go.

I have acheived this by adding a SELECT into the column header of 1 particular column. This will give the user the option of picking a Yes/No option and making all subsuequent rows in said particular column in the grid view, the choice of Yes or No dependant on which the user chooses.

I have successfuly managed to do this. My problem is now sending the "New" updated row data to the server.

I have tried saveRow() with the row id of each row in the view. This does not do anything. No AJAX calls are made.

Can someone point me in the right direction?

Thanks

回答1:

I write the answer only because you asked to point you in the right direction. Sending of the data from the local grid to the server is not complex (see here for example). The main problem is the case is concurrency.

In my opinion any web application should work not only as one user application. I wrote multiple answers (see here or here for example) where I described my opinion that one should better update modified rows directly after modification because of possible concurrency errors. The later the update take place the higher is the possibility that the same rows were already modified by another user from another computer. So I would recommend you to use standard saveRow behavior and send modified data directly after the modification.



回答2:

I have solved this by simply making an AJAX call myself to the file that is declared in JQGrid. Passing all relevant data everything worked how I needed it to