ungalnanban
ungalnanban

Reputation: 10327

Reload Jqgrid by given interval

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

Upvotes: 2

Views: 5095

Answers (1)

Oleg
Oleg

Reputation: 221997

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.

Upvotes: 7

Related Questions