Restart Jqgrid at the specified interval

I want to reload jqgrid every 5 minutes (set interval time), is there an option / event. how to do it?

+2
source share
1 answer

You can use setInterval JavaScript function to automatically update

 var grid = $("#list"), intervalId = setInterval( function() { grid.trigger("reloadGrid",[{current:true}]); }, 300000); // 300 sec === 5 min 

to stop reloading the grid, you can use another JavaScript function:

 clearInterval(intervalId); 

In "reloadGrid" I use the lesser known parameter current:true , which is described here , to save the current selection in the grid.

+7
source

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


All Articles