How to assign the Kendo UI Scheduler workDayStart Dynamically?

1 Answer 241 Views
Scheduler
Amar
Top achievements
Rank 1
Amar asked on 19 Jul 2021, 04:12 AM | edited on 19 Jul 2021, 04:20 AM

As of now in navigate event,  we are changing the workDayStart value based on the user selection, however our requirement is the workDayStart  value  has to change when their is an appointment exist in the non working hours. Could some one please help me how achieve this?

 

Ex: The scheduler workDayStart value 8:00 am, however I have an appointment at 6:00 am. So the scheduler has to automatically adjust the workDayStart as 6:00 am and the similar way need to for workDayEnd.

1 Answer, 1 is accepted

Sort by
0
Neli
Telerik team
answered on 21 Jul 2021, 10:37 PM

Hello Rammohan,

As far as I understand you need to have different workDayStart depending on the events that will be rendered in the current view in Scheduler.

If this is the case I would suggest you:

- After the Scheduler is initialized and also in the navigate event handlers to check the currently rendered events. In order to ensure that the events are rendered by the time you are trying to retrieve the needed information, you could use a setTimeout function.

var scheduler = $("#scheduler").data("kendoScheduler");
var events = scheduler.view()._cachedEvents;

- Then from the currently rendered events you could find the earliest start hour.

- Next, you need to set a different value to scheduler.options.workDayStart.

I would suggest you also take a look at the following thread from our Forum where setting business hours dynamically is discussed:

- https://www.telerik.com/forums/changing-businesshours-dynamically-lead-to-an-error-in-the-timelinemonth-view

Also as there is a feature request for setting the workingStartHour per day I would encourage you to cast a vote for the request.

- https://feedback.telerik.com/kendo-jquery-ui/1359304-how-to-set-the-business-hours-for-each-individual-day-instead-of-setting-workdaystart-for-all-days

I hope you will find the provided information helpful.

 

Regards,
Neli
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Scheduler
Asked by
Amar
Top achievements
Rank 1
Answers by
Neli
Telerik team
Share this question
or