Can we force user to only be able to select whole weeks?

1 Answer 15 Views
Calendar
Peter
Top achievements
Rank 1
Peter asked on 23 Feb 2024, 03:44 PM
Is it possible to make it so if a user clicks a day it selects the whole week, like clicking the week number does? Then is it also possible to capture multiple selected weeks (not necessarily concurrent weeks or in the same month), even if all the dates in those selected weeks are the output that would be fine

1 Answer, 1 is accepted

Sort by
0
Ivan Danchev
Telerik team
answered on 28 Feb 2024, 09:20 AM

Hello Peter,

The Calendar does not support this kind of selection. Refer to this article for more details on the available selection methods: https://docs.telerik.com/aspnet-mvc/html-helpers/scheduling/calendar/selection 

While it is possible to achieve (through jQuery) a selection of the whole week when a day of the week is clicked, for example see this REPL: https://netcorerepl.telerik.com/QoYGcsYj025EUr4q28, using this approach will prevent you from being able to properly select a date range (by clicking a day and then Shift + clicking another day). So be advised that this workaround has drawbacks.

As for getting the currently selected week/-s, there is no API method dedicated to that, but there is a method that returns the selected dates, regardless of whether they are in the same month or not: the selectDates() client-side method: https://docs.telerik.com/kendo-ui/api/javascript/ui/calendar/methods/selectdates  You can call it in the "change" event handler and it will return an array with all the selected dates.

Regards,
Ivan Danchev
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages. If you're new to the Telerik family, be sure to check out our getting started resources, as well as the only REPL playground for creating, saving, running, and sharing server-side code.

Tags
Calendar
Asked by
Peter
Top achievements
Rank 1
Answers by
Ivan Danchev
Telerik team
Share this question
or