How to find unsaved rows in a free-jqgrid?

46 Views Asked by At

This may be a strange question. But I encounter such a situation in my implementation. I have three free-jqgrid implementation in a single page. And I have, say 5 records in each. In the first grid, I open row number 2 for editing, do some modification to the columns but didn't click on save-icon to save the changes.

Then I jump to the second grid and open up say row number 4 for editing and make some modifications and don't save that also.

After all the grids, I have a button(say, a "Save" button) at the bottom of the page. Once this button is clicked, I need to validate the above grids and show a validation message that "You have some unsaved data in the grids" how to do this in free-jqgrid???

If that is possible, the next requirement is like, I have to save such unsaved data in the grids automatically - (without waiting for the user to click save for each edited row in each grid) to the db. Is it possible with free-jqgrid? If yes, please share me some example or suggest me how shall I achieve this?

1

There are 1 best solutions below

0
Tony Tomov On

This is is just a hint and do not know if in free-jqGrid this is still available.

When the inline editing is on - a grid parameter savedRow (array of objects) stores the original data of the row(s). In case the user cancel editing the row is restored from this parameter and in case of saving it is deleted.

The idea is simple you can check if this this array is not empty to determine which row is in edit mode and in case the user push a external button you can get the id from savedRow parameter and call saveRow methodto save the unsaved data.

I note again - this is just valid if this parameter is still available in free-jqGrid.