Question

I have a jqGrid subGrid using subGridRowExpanded. For each grid row, the subgrid contains 7 rows. Initially when a grid row is expanded, the subgrid retrieves the 7 rows of data using ajax. If I update one of the 7 rows within the subgrid and click on save, I use ajax to save all 7 rows to the server and I use editRow to save the 7 rows to the subgrid.

Here is the problem. If I close this subGrid and re-open it again, the 7 rows in the subGrid are filled with the data from the original load without any changes. The only way around this is to set cache:false in the ajax call.

Is there a way to update the cache when I update the row using editRow (key : true) to saveRow() instead of going back to the server again by turning off the cache?

Thanks.

Était-ce utile?

La solution

One can't just "update the cache" of web browser. Instead of that the server should include in the HTTP response headers which manage the cache. If you want that the every Ajax request will be get from the server you should include in the server response. For example I include practically always the following header

Cache-Control: private, max-age=0

in the response of the server which provide data for the grid. The answer shows how such headers can be set in ASP.NET.

Here you can read more about HTTP headers used for caching of data. The answer together with the previously referenced provide some details which are interesting in combination with jqGrid and jQuery.ajax.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top