从本地存储读取后,Kendo DateTimePicker没有时钟

问题描述 投票:0回答:1

场景在我的剑道网格中,我有DateTime选择器。接下来,我将DateTime选择器保存在本地存储中。当我再次访问我的页面时只有DatePicker(没有时钟)。我是剑道初学者。这不是我的代码,所以我不确定是不是全部。

columns.Bound(p => p.CreateDate)
                    .HeaderHtmlAttributes(headerHtmlAttributes)
                    .Filterable(true)
                    .Format("{0:yyyy-MM-dd HH:mm:ss}").Filterable(f => f.UI("DateTimeFilter"));

和过滤功能

function DateTimeFilter(control) {
    $(control).kendoDateTimePicker({
        format: "yyyy-MM-dd HH:mm:ss",
        timeFormat: "HH:mm:ss"
    });
}

保存功能

    var saveGridOptions = function (eventFromGrid) {
    var grid = eventFromGrid.sender,
        gridId = $(grid.wrapper).attr('id');

    localStorage[gridId + gridStorageSuffix] = kendo.stringify(grid.getOptions());
};

当我在cshtml文件中创建网格时也有代码:

.Events(ev =>
{
    ev.DataBound("GridHelper.saveGridOptions");
    ev.ColumnResize("GridHelper.saveGridOptions");
    ev.ColumnHide("GridHelper.saveGridOptions");
    ev.ColumnShow("GridHelper.saveGridOptions");
})
javascript c# kendo-ui local-storage kendo-asp.net-mvc
1个回答
0
投票

当您使用Kendo UI MVC包装器时,它使用标准的ASP.Net MVC方式来决定编辑属性时要使用的编辑器模板。

项目编辑器通常驻留在项目Views / Shared / EditorTemplates文件夹中。确保已包含/复制Telerik / Kendo提供的所有编辑器模板。 (例如Integer.cshtml,Date.cshtml,DateTime.cshtml)到此文件夹中。

您还可以指定手动使用哪个编辑器,例如: 1)用例如装饰你的视图模型属性。 [UIHint("DateTime")]或2)在网格配置中,列行添加.EditorTemplateName("DateTime")

这应该会自动使用Kendo DateTime小部件。

© www.soinside.com 2019 - 2024. All rights reserved.