javascript - HideDisable Weekends from Kendo UI dateTimepicker - Stack Overflow

I am using kendo DateTimePicker and just don't want user to select from Weekends.I have tried assi

I am using kendo DateTimePicker and just don't want user to select from Weekends.

I have tried assigning MonthTemplate() aproach as follows:

@(Html.Kendo().DateTimePickerFor(m => Data)
                       .MonthTemplate("# if (isWeekDay(data.date)) { #" +
                                                    "#= data.value #" +
                                                    "# } #" 
                                                    )  
    function isWeekDay(date)
        {
            var day = date.getDay();

            return (day % 6 != 0);
        }

But it helped me for just not displaying the Date in the Widget, but user still able to select it by clicking over the blank Cell in the Month Template.

Tried using Validation handling onChange Event and (e.StopPropagation for not closing the dropdown), but still its working.

Is it possible or doing efforts invain?

Thanks Sumeet

I am using kendo DateTimePicker and just don't want user to select from Weekends.

I have tried assigning MonthTemplate() aproach as follows:

@(Html.Kendo().DateTimePickerFor(m => Data)
                       .MonthTemplate("# if (isWeekDay(data.date)) { #" +
                                                    "#= data.value #" +
                                                    "# } #" 
                                                    )  
    function isWeekDay(date)
        {
            var day = date.getDay();

            return (day % 6 != 0);
        }

But it helped me for just not displaying the Date in the Widget, but user still able to select it by clicking over the blank Cell in the Month Template.

Tried using Validation handling onChange Event and (e.StopPropagation for not closing the dropdown), but still its working.

Is it possible or doing efforts invain?

Thanks Sumeet

Share Improve this question asked May 22, 2013 at 19:12 SumeetSumeet 9151 gold badge14 silver badges32 bronze badges 2
  • Looking for something like we have in Jquery dateTimepicker: $("#datepicker").datepicker({ beforeShowDay: $.datepicker.noWeekends }); – Sumeet Commented May 22, 2013 at 19:33
  • Friends, is somethign wrong with my question. Its been more than 24 hrs and this is not able to catch even a single attention? Am I doing things pletely wrong or there is something wrong in stating my problem. Please guide me.. – Sumeet Commented May 23, 2013 at 21:03
Add a ment  | 

1 Answer 1

Reset to default 6

Hope you still need help about your question. This is a way to disable click on weekends.

.kendoDatePicker({
    open: function() { $('.k-weekend a').bind('click', function() { return false; }); }
});

.k-weekend is the class associated to weekend cells. So, it's easy to disable the click on those cells. It's also possible to put some CSS to change the aspect of those cells.

Hope this will help. Laurent

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745342180a4623377.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信