Kendo DatePicker 最大日期问题 [英] Kendo DatePicker Max date issue
问题描述
我有两个剑道 DatePickers 来选择工作的开始和结束日期.作业由多个任务组成,其中包含自己的完成日期(任务列在网格中,每个记录都使用 kendo DatePicker 以选择完成日期)
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).
问题是当用户清除作业的结束日期时,我将任务级别 DatePicker 的最大日期设置为 (2099, 11.31),但是当我单击任务级别日期选择器时,我无法立即导航到下个月.如果我点击其他日期选择器可以导航.当我删除工作级别的开始或结束日期时会发生这种情况.
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.
推荐答案
好吧,这个问题似乎不再活跃"了,但作为参考,我设法通过在 kendo 上调用 .enable() 来解决这个问题设置新值后的控制(我使用的是 ko + ko-kendo 但除此之外它完全相同)小提琴:http://jsfiddle.net/AlexPaven/m5M46/2/
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/
小提琴代码:
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);
我有理由确信这没有副作用;如果您想保留启用状态,我确定您可以检查状态并调用 enable+disable 或 disable+enable.
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.
天哪,这很烦人.
错了,我被更复杂的行为所迷惑.只有在每次设置新的最大值时都打开日期选择器,才会出现错误;第一次更改被确认,但随后不是.我想我会再花几分钟...
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...
这篇关于Kendo DatePicker 最大日期问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!