【问题标题】:free jqgrid - date formatter newformat with time always invalid免费的 jqgrid - 日期格式化程序 newformat,时间总是无效
【发布时间】:2018-07-24 17:07:47
【问题描述】:

当我尝试添加或编辑具有正确数据的新行(包括时间,例如:2018-01- 01 07:00:00) 在这个字段中。

formatter: "date", formatoptions: { "srcformat": "ISO8601Long", "newformat": "Y-m-d H:i:s" }

谁能帮我让它正常工作?

JSFIDDLE:link

【问题讨论】:

    标签: time jqgrid free-jqgrid jqgrid-formatter


    【解决方案1】:

    问题的原因是您的演示中使用了editrules:{date:true}。验证规则date:true只能在jqGrid中使用没有时间的日期。

    我建议您删除 editrules:{date:true} 或改用自定义数据验证。您可以使用editrules:{custom:true, custom_func: function(value,name,iCol) {...}}(参见here)在旧样式中使用自定义验证,或者使用custom 回调函数的新样式:editrules:{custom: function(options) {...}}。在肯定验证的情况下,回调函数应返回[true, ""][true]。如果出现验证错误,返回值应该是[false, "your error message"];

    【讨论】:

    • @slako:不客气!如果问题得到解决,您应该"accept" 回答并获得您的第一个声誉积分。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-03-07
    • 1970-01-01
    • 1970-01-01
    • 2014-09-02
    相关资源
    最近更新 更多