Kendo Grid Date排序与M / d / yy无法正常工作

时间:2014-10-23 22:07:54

标签: kendo-ui kendo-grid

我已经搜查了这些互联网,并且无法得出结论为什么这样做不像我在许多演示中看到的那样。我必须遗漏一些简单的东西...除了大多数例子不使用日期的M / d / yy格式。当我使用这种格式时,我的数据最终会出现如下列:

1/19/14
10/05/14
2/02/14
5/15/14

有什么想法吗?你可以看到我的日期列模板被注释掉了,因为它实际上并没有做任何有意义的事情。

这是我的网格:

$("#mygiving-details-grid").kendoGrid({
        dataSource: {
            schema: {
                model: {
                    fields:{
                        date: {type: "date"},
                        fund: {type: "string"},
                        desc: {type: "string"},
                        name: {type: "string"},
                        type: {type: "string"},
                        amt: {type: "number"}
                    }
                }
            }
        },
        sortable: true,
        toolbar: "<span>Filter goes here</span>",
        columns: [{
            field: "date",
            title: myGivingModel.local.giving.date,
            // format: "{0:"+systemDateFormat+"}",
            // template: "#= kendo.toString(date, '"+systemDateFormat+"') #",
            width: 100
        }, {
            field: "fund",
            title: myGivingModel.local.giving.fund
        }, {
            field: "desc",
            title: myGivingModel.local.giving.description
        }, {
            field: "name",
            title: myGivingModel.local.giving.name
        }, {
            field: "type",
            title: myGivingModel.local.giving.type
        }, {
            field: "amt",
            title: myGivingModel.local.giving.amount,
            attributes:{
                style:"text-align:right;"
            },
            format: "{0:c}"
        }]
    });

1 个答案:

答案 0 :(得分:0)

使用https://github.com/StefH/KendoGridBinderEx时,这应该可以正常工作。我刚刚更改了Scripts \ common.js这段代码:

var _DefaultDateFormat = "MM/dd/yyyy";
// into this
var _DefaultDateFormat = "M/dd/yy";

并且排序按预期工作。