2

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

BenMorel
  • 34,448
  • 50
  • 182
  • 322
ungalnanban
  • 9,539
  • 10
  • 44
  • 55

1 Answers1

7

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.

Community
  • 1
  • 1
Oleg
  • 220,925
  • 34
  • 403
  • 798
  • Awesome! Another helpful jQGrid answer by Oleg! – FastTrack Aug 07 '12 at 15:51
  • @FastTrack: You are welcome! [Another answer](http://stackoverflow.com/a/10461964/315935) could be interesting for you in connection with automatic reloading of grids – Oleg Aug 08 '12 at 07:09