This is a migrated thread and some comments may be shown as answers.

Programmatically changing hours shown on screen

1 Answer 38 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Jaesoon
Top achievements
Rank 1
Jaesoon asked on 01 Nov 2018, 03:02 AM

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

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 02 Nov 2018, 12:40 PM
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.
Tags
Scheduler
Asked by
Jaesoon
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or