문제

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.

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top