Kendo UI datepicker与Chrome 56不兼容

Kendo UI datepicker与Chrome 56不兼容

问题描述:

将Chrome更新到最新版本56.0.2924.76(64位)后,我们的Kendo datepickers开始无法正常工作。

After updating Chrome to its last version 56.0.2924.76 (64-bit), our Kendo datepickers started not to work properly.

所有日期戳记都使用ViewModels进行绑定,现在他们不显示他们的价值观。如果我们检查它们,我们会看到值被设置,但没有显示。

All datepickers were binded using ViewModels, and now they don't show their values. If we inspect them we see the value is set, but it's not been shown.

例如:

@(Html.Kendo().DatePicker()
                    .Name("DateFrom")
                    .Start(CalendarView.Month)
                    .Depth(CalendarView.Month)
                    .Format("MM/dd/yyyy")
                    .HtmlAttributes(new { @id = "ClosingStartDate", @placeholder = "enter date from", @class = "masked-date" }))

如果我使用Chrome的开发者工具检查此元素,我有以下结果:

If I inspect this element with Chrome's Developer tool I have this result:

<input class="k-input masked-date" id="ClosingStartDate" name="DateFrom" placeholder="enter date from" type="text" value="12/21/2016" data-role="datepicker" readonly="" disabled="disabled" maxlength="20" style="width: 100%;">

但是这样显示

当我们用KnockOut绑定属性值时,所有的日期检查器都可以正常工作。

When we bind property value with KnockOut all datepickers work fine.

我们的Kendo版本是:Kendo UI Complete v2012.2.913

Our Kendo version is: Kendo UI Complete v2012.2.913

有另一种方法来绑定吗?我们应该使用Chrome v.56改变什么?

Is there another way to bind it? What we should change using Chrome v.56?


目前,DatePicker包装器呈现INPUT元素键入日期。当Kendo DatePicker在客户端上初始化时,将输入的类型更改为text。因此,我们避免了日期输入的本机渲染。如果JavaScript被禁用,则Kendo DatePicker将不会被初始化,并且输入可以用作本地输入。

Currently, the DatePicker wrapper renders INPUT element type "date". When the Kendo DatePicker initializes on the client it changes the type of the input to "text". Thus we avoid the native rendering of the "date" input. ​If the JavaScript is disabled, then the Kendo DatePicker will not be initialized and the input can be used as native one.

不幸的是,一些浏览器具有本地支持date 键入(特别是Chrome)验证设置值,如果它不是正确的格式([RFC 3339]中定义的有效全日期)),则会被忽略。现在,您可以将输入的类型永久更改为text,并避免与本地输入相关的任何问题:

Unfortunately, some browsers with native support for "date" type (Chrome in particular) validate the set value and if it is not in the correct format (a valid full-date as defined in [RFC 3339]) then it is ignored. For now you can change the type the input to "text" permanently and avoid any issues related with the native inputs:



@(Html.Kendo().DatePicker()
.Name("datepicker")
.Value("10/10/2011")
.HtmlAttributes(new { type = "text" }))

只需添加属性 =text根据kendo UI论坛的建议,它适用于我。

I just add attribute type="text" based on the suggestion in kendo UI forum and it works for me.

这里有一个链接: http://www.telerik.com/forums/date-field- not-rendering-correct-in-browsers-that-support-html-5