Programmatically changing hours shown on screen

2 posts, 0 answers
  1. Jaesoon
    Jaesoon avatar
    60 posts
    Member since:
    Oct 2012

    Posted 31 Oct 2018 Link to this post

    I'm trying to create a scheduler to present shift work for users

     

     

    This view will require 2 sets of data to show up, one from 7am to 7pm and one from 7pm to 7am.

     

    Is there a way to programmatically set the start and end times for the screen using Javascript so that when the clock goes to 7am, the view shows 7am to 7pm, and when it goes to 7pm, the screen automatically jumps to 7pm - 7am?

     

    If the above is not possible, what is the closest way that we can achieve the above functionality?

     

    Thanks

  2. Dimitar
    Admin
    Dimitar avatar
    667 posts

    Posted 02 Nov 2018 Link to this post

    Hello Jaesoon,

    In order to set the Scheduler's startTime and endTime options after the widget initialization, the Scheduler has to be destroyed and then re-created with the new options as follows:
    <script>
      function changeStartEndTime(e) {
        var scheduler = $("#scheduler").getKendoScheduler();
        var options = scheduler.options;
         
        scheduler.destroy();
        options.startTime = new Date("2013/10/6 09:00 AM")
        options.endTime = new Date("2013/10/6 12:00 AM");
     
        $("#scheduler").empty().kendoScheduler(options);
      }
    </script>

    Additional information regarding how to correctly destroy Kendo widgets is available in the following article:


    Regards,
    Dimitar
    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