0

我正在使用带有 jquery 网格的 spring mvc。我的行中有一个日期字段。在 Json 中,我得到的日期为

“发布日期”:1406399400000

但它在表中显示为“NaN/NaN/NaN”。在我的 bean 类中,我将其保留为 java Date 格式。网格配置列模型如下。

colModel:[
               {name:'name', label: 'Product Name', width: 300},

               {name:'releaseDate', label: 'Release Date',formatter:'date',formatoptions: {newformat:'m/d/Y'}, width: 300}

           ],

我正在使用 jqgrid 4.6。非常感谢任何帮助。

谢谢你!

4

1 回答 1

0

例如,您可以使用自定义格式化程序,它formatter: "date"使用srcformat: "u". formatoptions尝试类似的东西

{
    name: 'releaseDate',
    label: 'Release Date',
    formatoptions: {newformat:'m/d/Y'},
    formatter: function (value, options) {
        if (typeof value === "number" && value > 1000000000000) {
            return $.fn.fmatter.call(this, "date", value/1000, options);
        } else {
            return " ";
        }
    },
    width: 300
}

如果是字符串输入值,您可以使用parseInt. 可能您也必须提供unformatsorttypeas 功能。

于 2014-08-01T20:49:20.590 回答