【问题标题】:Kendo Grid Date Formatting剑道网格日期格式
【发布时间】:2019-07-11 10:53:36
【问题描述】:

在数据库中有两列

我想根据剑道网格中的“日期格式”列格式化“创建日期”。我可以使用模板:“#= kendo.toString(kendo.parseDate(CreatedDate), DateFormat) || '' #”,但它不会在列过滤器的日期时间选择器中显示正确的日期格式。

所以我看起来像这样 //格式:"{ 0:#= DateFormat #}",

代码示例 --------------------------------------------- ------ 列: [ { 字段:“创建日期”, 宽度:“10%”, 标题:“{{'CreatedDate'}}”, 隐藏:真实, //格式:"{ 0:#= DateFormat #}", }


【问题讨论】:

    标签: .net kendo-grid


    【解决方案1】:

    您应该在模型中指定数据类型。例如

    dataSource: {
        transport: {
            read: {
                url: "https://demos.telerik.com/kendo-ui/service/tasks",
                dataType: "jsonp"
            },
        },
        schema: {
            model: {
                fields: {
                    CreatedDate: { type: "date" }
                }
            }
        }
    }
    

    然后在列上,

    columns:[
        ...
        { title: "CreatedDate", template:"#=kendo.toString(CreatedDate,DateFormat)#"},
        ...
    ]
    

    【讨论】:

    • 这不会改变过滤框日期时间选择器的格式
    【解决方案2】:

    这不会改变过滤框的日期时间选择器的格式

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-07-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-01-06
      • 2023-03-03
      相关资源
      最近更新 更多