【问题标题】:JQGrid Date Formatting IssueJQGrid 日期格式问题
【发布时间】:2015-10-27 08:56:23
【问题描述】:

最近我们遇到了 jQGrid 错误表示日期的问题。表中还有其他日期似乎工作得很好。 但是,某些日期失败了。

我创建了一个fiddle here 来演示该问题。 请注意,输入日期值为“10/24/2015”,jQGrid 的格式为“m/d/Y”。然而,表中的输出是“06/06/2017”。

日期列的列定义如下所示:(fiddle 是由 Oleg 自己编写的)。

    {
        name: 'invdate', index: 'invdate', search: false, editable: true, align: "left", width: 75, 
        formatter: function (cellvalue, options, rowObject) {
            return cellvalue === null ? "N/A" : $.fn.fmatter.call(this, "date", cellvalue, options, rowObject);
        }, formatoptions: { newformat: "m/d/Y" }
    }

我仍在分析源代码以了解 jQgrid 如何格式化日期。任何帮助将不胜感激。

【问题讨论】:

    标签: jquery date jqgrid


    【解决方案1】:

    我猜你也需要在formatoptions 中包含srcFormat

    formatoptions: {
        srcformat: "m/d/Y", //<----add this too
        newformat: "m/d/Y"
    }
    

    Fiddle

    【讨论】:

    • 我现在觉得自己很蠢 :)。非常感谢。但是默认的 srcformat 是什么?
    • 和我看到的一样,10/24/2015m/d/Ysrcformat 是更新后的 jQgrid 库中的要求。
    猜你喜欢
    • 2013-05-30
    • 2018-05-13
    • 2012-05-24
    • 1970-01-01
    • 2011-09-20
    相关资源
    最近更新 更多