Kendo UI 网格 MVC - 批量内联编辑 - 日期时间字段未显示日期选择器
Kendo UI Grid MVC - Batch inline editing - Datepicker not displayed for DateTime field
我正在使用具有 4 列的 MVC Kendo 网格,其中一列是 DateTime 字段。
网格允许内联和批量编辑。当我单击布尔字段时,它会显示一个复选框。如果我单击一个文本字段,它会显示一个 TextField。我猜想对于日期字段,它应该显示一个 DatePicker。
相反,它显示了一个 TextField。
这是网格上的列声明:
@(Html.Kendo().Grid<MyModel>()
.Name("Grid")
.Columns(columns =>
{
columns.Bound(e => e.MyDate).Format("{0:dd.MM.yyyy}").Title("Date");
})
.Editable(x => x.Mode(GridEditMode.InCell))
.Batch(true)
这是我的模型属性:
[DataType(DataType.DateTime)] // making data type as date
public DateTime? MyDate{ get; set; }
我错过了什么?我目前唯一的猜测是缺少 .js 文件或其他什么?请告诉我。
谢谢!
您必须为此添加编辑器模板。您可以从 Kendo 站点或 demo.
获取以下所有编辑器模板
Date.cshtml
@model DateTime?
@(Html.Kendo().DatePickerFor(m => m))
如有任何疑问,请告诉我。
我正在使用具有 4 列的 MVC Kendo 网格,其中一列是 DateTime 字段。 网格允许内联和批量编辑。当我单击布尔字段时,它会显示一个复选框。如果我单击一个文本字段,它会显示一个 TextField。我猜想对于日期字段,它应该显示一个 DatePicker。 相反,它显示了一个 TextField。
这是网格上的列声明:
@(Html.Kendo().Grid<MyModel>()
.Name("Grid")
.Columns(columns =>
{
columns.Bound(e => e.MyDate).Format("{0:dd.MM.yyyy}").Title("Date");
})
.Editable(x => x.Mode(GridEditMode.InCell))
.Batch(true)
这是我的模型属性:
[DataType(DataType.DateTime)] // making data type as date
public DateTime? MyDate{ get; set; }
我错过了什么?我目前唯一的猜测是缺少 .js 文件或其他什么?请告诉我。 谢谢!
您必须为此添加编辑器模板。您可以从 Kendo 站点或 demo.
获取以下所有编辑器模板Date.cshtml
@model DateTime?
@(Html.Kendo().DatePickerFor(m => m))
如有任何疑问,请告诉我。