【发布时间】:2018-08-07 05:21:39
【问题描述】:
您好,我正在使用 jqGrid,我的日期 src 格式类似于 2018 年 2 月 27 日晚上 7:22:43 所以我把它格式化了
formatter: 'date', formatoptions: { srcformat: 'M d, Y g:i:s A', newformat: 'm/d/Y'}
现在,过滤器不仅在一个月内有效 我尝试添加 sorttype: 'date' 选项,但添加后过滤器也停止工作年和日。
我想我可能错过了导致此问题的格式选项中的某些内容 请指教。
我做了一些改变 下面是更新的代码 请看一下。
{
label: '<font size="2">SSC Support Approved Through Date</font>',
name:'supportApprovedThroughDate',
index:'myDate',
editable: true,formatter: 'date',
sorttype: 'date',
formatoptions: { srcformat: 'M d, Y g:i:s A', newformat: 'm/d/Y'},
searchoptions: {
sopt: ['eq'],
placeholder:'Filter By Approved Through Date',
title:'Filter By Approved Through Date'
}
},
{
name : 'myDate',
hidden: true,
jsonmap : function(item) {
console.log(item);// Not getting printed.
return $.jgrid.parseDate.call($("#jqGrid")[0] , 'M d, Y g:i:s A', item.supportApprovedThroughDate , 'm/d/Y');
}
}
【问题讨论】:
-
使用哪个版本的 jqGrid - Guriddo jqGrid、free-jqGrid 或 jqGrid
-
我们正在使用 jqGrid 5.0.1 guriddo.net
-
请看at this post,那里的问题类似,需要根据自己的需要进行调整
-
嗨,托尼,我已经按照链接尝试过,但如果可能的话它仍然无法正常工作,请您看看有问题的代码 sn-p
-
上述代码仅在数据类型为 local 或 loadonce 参数为 true 时有效。如果数据类型参数不是本地的并且您使用服务器端分页和搜索,您将需要在您的服务器中有逻辑以在日期上进行正确的搜索。在所有其他情况下,我们需要问题的工作示例