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

Disable dates based on array

7 Answers 298 Views
Date/Time Pickers
This is a migrated thread and some comments may be shown as answers.
Ryan
Top achievements
Rank 1
Ryan asked on 05 Aug 2013, 04:09 PM
Administrators of my app are able to set certain days as "off" days for our company. I would like to be able to tell the DatePicker widget that those dates should be disabled from selection. We are currently using the min/max date settings with very positive feedback but these dates fall inside of the min/max range. Any help is greatly appreciated. I am currently using validation to check if the selected date is within that range and returning an error. Unifying the experience for my users is the ultimate goal, so it's preferable the dates just be disabled from selection.

Thanks!

Ryan Filpi

7 Answers, 1 is accepted

Sort by
0
Alexander Popov
Telerik team
answered on 07 Aug 2013, 01:05 PM
Hi Ryan,

Similar behavior is displayed in this demo, however I've taken an extra step and customized it to fit your needs better. Here is a working example.

I hope this helps.

Regards,
Alexander Popov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Ryan
Top achievements
Rank 1
answered on 07 Aug 2013, 05:53 PM
That is absolutely fantastic! 

I slightly modified the source code you provided so that the parent is hidden (display:none) so that the dates are hidden from view like dates outside of the min/max.

Is there a way to modify this configuration such that if a user types a date that has been disabled directly into the textbox  a null can be passed to the Kendo Validator so that it recognizes the value as being invalid (as it does for dates outside the min/max)?

Thank you so much, Alexander.

0
Alexander Popov
Telerik team
answered on 09 Aug 2013, 01:05 PM
Hello Ryan,

The Kendo UI Validator supports custom validation rules. You might use them to check if the selected date matches any of the "disabled" days.
Here is an example of how the custom rules work.

Kind regards,
Alexander Popov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Alessandro
Top achievements
Rank 1
answered on 18 Aug 2014, 09:03 AM
Hi Alexander,

i tried your working example but i think there's a problem: after changing the month the disabled dates are still selectable.
For example, going from August to July (or September) and then back to August, you will find all dates selectable.

Thank you,
Alessandro
0
Alessandro
Top achievements
Rank 1
answered on 18 Aug 2014, 01:16 PM
Sorry Alexander, i just saw you already posted a working example on another thread.
Thank you!
0
Jim
Top achievements
Rank 1
answered on 24 Sep 2014, 06:49 PM
Where is the working thread? The one listed here doesnt disable them properly they are clickable after changing the month.
0
Jim
Top achievements
Rank 1
answered on 24 Sep 2014, 11:51 PM
http://www.telerik.com/forums/deactivating-dates-in-datepicker
Tags
Date/Time Pickers
Asked by
Ryan
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
Ryan
Top achievements
Rank 1
Alessandro
Top achievements
Rank 1
Jim
Top achievements
Rank 1
Share this question
or