1

I have a kendo grid and i want to refresh the grid in every 5 minutes with alert that the grid will be refreshed.I tried below code but the popup is coming multiple time.

function showGrid()
{
----
----
refreshQueue();
}
refreshQueue()
{
 window.setInterval(function () {

        alert("Your session has expired, and grid will be refreshed with the latest data.");
        $("#queueList").data("kendoGrid").dataSource.read();       
    }, 600000); 
}

Can anyone help me on this?

sandeep.mishra
  • 825
  • 4
  • 19
  • 40
  • How often do you call `showGrid()`? You have to set the interval only once or clear it before you set it again, see https://www.w3schools.com/jsref/met_win_clearinterval.asp – Carsten Franke Aug 12 '19 at 07:21
  • the grid is loaded by selecting a dropdown.I caled refreshqueue() method after the showgrid() method – sandeep.mishra Aug 12 '19 at 08:59

1 Answers1

1

The implementation with setInterval is not the cleanest implementation. Please check Telerik implementation with SignalR. https://demos.telerik.com/kendo-ui/grid/signalr

Some documentation about SignalR https://dotnet.microsoft.com/apps/aspnet/signalr

Here is how to refresh the grid in @Jaimin answer Reloading/refreshing Kendo Grid

Your implementation would be:

setInterval(function () {
    alert("Your session has expired, and grid will be refreshed with the latest data.");
    $("#queueList").data('kendoGrid').refresh();
}, 300000);
CMartins
  • 3,247
  • 5
  • 38
  • 53