Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kendo DatePicker Max date issue

I have a two kendo DatePickers to select start and end date of a job. job consists of multiple tasks which contains its own completion date (tasks are listed in a grid with kendo DatePicker for each record to select the completion date)

I set max and min of each task when user sets the job start and end date. I use kendo to bind data with kendo (through kendo knockout).

problem is when user clears the end date of a job,I set the max date of task level DatePicker to (2099, 11.31), but when I click on the task level datepicker I cant navigate to next month at once. if i click on some other datepicker can navigate. this happens when I delete start or end date of the job level.

like image 985
Shivanka Avatar asked Nov 13 '22 14:11

Shivanka


1 Answers

Well this question doesn't seem to be 'active' anymore but for reference, I managed to get around the problem by calling .enable() on the kendo control after setting the new value (I was using ko + ko-kendo but other than that it's exactly the same) Fiddle: http://jsfiddle.net/AlexPaven/m5M46/2/

Code in fiddle:

var vm = {
    val: ko.observable(new Date()),
    mx: ko.observable(new Date())
};

ko.applyBindings(vm);

setTimeout(function() { 
    vm.mx(new Date(2099, 11, 31)); 
    var d = $('#a').data('kendoDatePicker');
    d.enable(); // commenting this exhibits the problem - max constraint isn't updated visually
}, 3000);

I'm reasonably sure this has no side effect; if you want to preserve the enabled state I'm sure you can check the state and call enable+disable or disable+enable.

Jeez, this was annoying.

EDIT: wrong, I was fooled by the behavior which is a little more involved. You only get the bug if you open the datepicker each time you set a new maximum; the first time the change is acknowledged but subsequent times it's not. I'll spend a few more minutes with this I suppose...

like image 97
Alex Paven Avatar answered Dec 15 '22 19:12

Alex Paven