Refresh data in scheduler view every n minutes without user interaction

5 posts, 0 answers
  1. Anamika
    Anamika avatar
    157 posts
    Member since:
    Mar 2014

    Posted 15 Aug 2017 Link to this post

    Hello,

     

    I have a Kendo Scheduler bound to datatable dynamically. The user will have this view open whole day and would like to refresh the data in current view updated every 5/10 minutes as set in some Settings. The user do not Need to interact or refresh the page. Is there some property which i can use or any idea how to achieve a Server read automatically every n minutes and refresh current view.

     

    Thanks

     

    Anamika

  2. Ivan Danchev
    Admin
    Ivan Danchev avatar
    2086 posts

    Posted 16 Aug 2017 Link to this post

    Hello Anamika,

    You can call the Scheduler dataSource's read method every 5 or 10 min by using the setInterval method:
    function readData() {
        var scheduler = $("#scheduler").data("kendoScheduler");
      scheduler.dataSource.read();
      scheduler.view(scheduler.view().name)
    }
       
    (function(){
     setInterval(function (){ readData();}, 300000);
    })();

    Dojo example in which the read method is called every 5 minutes (300000 milliseconds).

    Regards,
    Ivan Danchev
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. Anamika
    Anamika avatar
    157 posts
    Member since:
    Mar 2014

    Posted 17 Aug 2017 Link to this post

    Thanks Ivan

  4. Mike
    Mike avatar
    5 posts
    Member since:
    Aug 2013

    Posted 30 Aug 2018 in reply to Ivan Danchev Link to this post

    Is there a way to check to see if the custom editor is running (currently open) and only perform the refresh if it isn't open? Otherwise, if someone is in the middle of creating an event it will refresh and the editor closes.

    Thanks,

    Mike

  5. Ivan Danchev
    Admin
    Ivan Danchev avatar
    2086 posts

    Posted 03 Sep 2018 Link to this post

    Hello Mike,

    You can add the following condition, which checks whether the Scheduler's editor is open, to the readData function:
    function readData() {
      var scheduler = $("#scheduler").data("kendoScheduler");
         
      if($(".k-scheduler-edit-form").length == 0) {
        scheduler.dataSource.read();
        scheduler.view(scheduler.view().name);
      }
    }


    Regards,
    Ivan Danchev
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top