本文介绍了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?

推荐答案

不幸的是,一些浏览器具有本地支持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.

这里有一个链接:

这篇关于Kendo UI datepicker与Chrome 56不兼容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 20:50