Hi, if you add an event that starts 08/17/2015 8:00AM and ends at 08/19/2015 : 8h00PM, the scheduler will display the item as if it was an all day event for all three days which is not visually useful.
I would like to be able to show the event starting at 8h00AM the first day all the way down to the end of the day, then the second day shown as an all day item and finally have the event continue on the last day from 12:00AM to 8h00PM.
Is there a way to achieve this with the scheduler?
(I attached some screenshots to better explain my requirements)
7 Answers, 1 is accepted
Basically current behavior is intended in the "day" and "week" views - events longer than 24 hours are rendered as all-day events. That why in current case I would suggest to switch to "timeline" views where all events are rendered as-is.
Regards,
Vladimir Iliev
Telerik
Please note that this behavior is already supported in timeline views. In day and week views however the same behavior would require creating custom view by extending the existing one and overriding the methods responsible for deciding where given event should be rendered. Currently I could only suggest to check the following demo which shows how to create custom view by extending one of the build-in ones.
Regards,
Vladimir Iliev
Telerik
Use an sql query to split the event into multiple events, one for each day. Then you can alter the times depending on whether the event begins or ends on that day, so it takes up the full day on the schedule as you are trying to accomplish. This is the code I used in my sql query in order to achieve this. I know this is an old question, but hopefully it will help someone.
WITH n(n) AS
(
SELECT ROW_NUMBER() OVER (ORDER BY [object_id])-1 FROM sys.all_columns
),
d(n,s,e,dd,et) AS
(
SELECT n.n, d.StartTime, d.EndTime,
DATEDIFF(DAY, d.StartTime, d.EndTime),
DATEADD(DAY, -1, DATEADD(DAY, 1, DATEADD(DAY, n.n,
StartTime)))
FROM n INNER JOIN
(
SELECT '2020-12-21 12:00:00.000' AS StartTime,
'2020-12-26 14:00:00.000' AS EndTime
) d
ON d.EndTime >= DATEADD(DAY, n.n-1, d.StartTime)
)
SELECT
new_from_date = CASE n WHEN 0 THEN s ELSE DATEADD(Hour, 8, Convert(datetime, Convert(date, et))) END,
new_to_date = CASE n WHEN dd THEN e ELSE DATEADD(Hour, 19, Convert(datetime, Convert(date, et))) END
FROM d WHERE dd >= n
Hello Jonathan,
Thank you for your input. I believe other users will also find that approach useful for visually representing longer events in the Scheduler. The only thing that I would like to note is that editing such an event will automatically open the edit pop-up only for that portion of the event that has been clicked.
Regards,
Veselin Tsvetanov
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.
Hello Jonathan,
Thank you again. The approach outlined will indeed cover properly the Scheduler editing scenario.
Regards,
Veselin Tsvetanov
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.