Reload Jqgrid by given interval

后端 未结 1 1331
醉话见心
醉话见心 2020-12-10 10:01

I want to reload a jqgrid each 5 min (given interval time), is there any option/event. how to do this?

相关标签:
1条回答
  • 2020-12-10 10:20

    You can use setInterval JavaScript function to do automatic refreshing

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

    to stop the grid reload you can use one more JavaScript function:

    clearInterval(intervalId);
    

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

    0 讨论(0)
提交回复
热议问题