我正在尝试在 jqGrid 中设置时间格式。这是行不通的。我想在区域设置文件中使用预定义的格式化程序。这是 col 的定义方式:
{ name: 'Tid', index: 'Tid', width: 65, editable: true, formatoptions: { mask: 'ShortTime' }, editrules: { time: true} }
我尝试了几种不同的替代方案,但它似乎对网格没有影响。
最佳答案
在我看来,文档还不够清楚。正确的语法应该是
formatoptions: { srcformat: 'ISO8601Long', newformat: 'ShortTime' }
额外的问题是:默认值srcformat
定义于 $.jgrid.formatter.date.srcformat
(在 grid.locale-en.js
中):“Y-m-d”。因此,默认情况下,输入数据中的任何时间信息都将被忽略。
参见the demo .
如果你想在网格中使用本地数据,你还应该考虑我报告的错误here 。该错误是fixed github上的代码,但那是在jqGrid 4.3.1发布之后。
关于jquery - jqGrid 中的时间格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10010595/