0

Is it Possible to let the jqgrid Update itself without loading the page ?

I mean live Update

For example I want the grid to show the on line Visitors on my site but I don't want to refresh the page each time to see the new users , does jqgrid support this ?

siva
  • 525
  • 2
  • 14

2 Answers2

2

Option 1: Poll the changes using a timer function and call following code to load the grid:

$('#grid').trigger( 'reloadGrid' );

Option 2: Push the changes as they happen i.e. a new line visitor added using SignalR.

SBirthare
  • 5,117
  • 4
  • 34
  • 59
  • can signalR be implemented for jqgrid? – siva Oct 28 '14 at 09:26
  • I believe its not tied to any UI control, all it would do for you is to enable you to set up a connection between client and server. Server then can push the changes. Client will get an event fired and can act on it i.e. reload grid. – SBirthare Oct 28 '14 at 09:29
0
<script>
function refresh_grid(new_url)
{
  jQuery("#jqgrid_table").jqGrid().setGridParam({datatype:'json'});
  jQuery("#jqgrid_table").jqGrid().setGridParam({url:new_url}).trigger("reloadGrid");
  jQuery("#jqgrid_table").jqGrid().trigger("reloadGrid");
}
var myVar = setInterval(function () {myTimer()}, 1000);
function myTimer() {
 var url = " ...your url...";
 refresh_grid(url);
}