Control Scheduler drag limitations, based on work times

1 Answer 72 Views
Scheduler
Grant
Top achievements
Rank 3
Iron
Iron
Veteran
Grant asked on 22 Sep 2022, 06:42 AM

Hi Team, 

Im looking at the SchedulerEditItem#Controlling-the-edit, I like the idea of preventing the drag, however I see you have had to hardcode the dates and times.

The date isnt that big of a deal, determining the working times seems to be though. I've tried to extract them from the views exposed by the useSchedulerViewsContext() hook, as well as the view default props, like WeekView.defaultProps, with no success. These values are available from the hook if you explicitly set them, but I cannot find how to access the defaults.

In my demo you will see what Im talking about. In the console Im printing a bunch of different props. Only the startTime is accessible because its set on the WeekView.

Youll see I've commented out a line thats trying to print the dateRange of the view exposed by the hook, this function crashes.

Thanks, 
Grant

1 Answer, 1 is accepted

Sort by
1
Accepted
Konstantin Dikov
Telerik team
answered on 25 Sep 2022, 06:47 AM

Hello Grant,

Thank you for reaching out to us.

The dateRange function should be used for changing the date range and it expects an SchedulerViewDateRangeArgs as argument. For getting the start and end dates of the view I would suggest using the useSchedulerDateRangeContext instead:

As for the default working hours, I have to say that there is no option for taking them through a context and they must be hardcoded as shown in the demo. 

 

Regards,
Konstantin Dikov
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.

Grant
Top achievements
Rank 3
Iron
Iron
Veteran
commented on 26 Sep 2022, 06:44 AM

Thanks for the clarification Konstantin.
Tags
Scheduler
Asked by
Grant
Top achievements
Rank 3
Iron
Iron
Veteran
Answers by
Konstantin Dikov
Telerik team
Share this question
or