【发布时间】:2017-07-12 12:03:41
【问题描述】:
我在 jqgrid 中有一个应该处理日期信息的列,实际上我对这个列有很多问题:
1- 日期从后端返回并显示如下29/03/2017 00:00:00 ...所以当我尝试使用这样的格式化程序时:formatter: "date", formatoptions: { newformat: "d-M-Y" },日期被损坏,并且显示完全不同的日期09-Aug-2033
2- 当我尝试添加日期选择器搜索时,它什么也没做,我的意思是根本没有过滤发生并且网格数据保持不变,无论我是否使用上述格式化程序
其实我是靠奥列格的例子here
我的代码经过一些修改:
{
name: 'F_GCEO_MEETING_DATE',
index: 'F_GCEO_MEETING_DATE',
align: 'left',
width: 100,
sortable: true,
search: true,
editable: false,
cellEdit: false,
formatter: "date",
formatoptions: {
newformat: "d-M-Y"
},
editoptions: {
dataInit: function(elem) {
$(elem).datepicker({
dateFormat: "dd-M-yy",
buttonImageOnly: true,
buttonText: "Select date",
autoSize: true,
changeYear: true,
changeMonth: true,
showButtonPanel: true,
showWeek: true,
onSelect: (function() {
setTimeout(function() {
this.triggerToolbar();
}, 0);
})
});
}
},
searchoptions: {
sopt: ["eq", "ne", "lt", "le", "gt", "ge"],
attr: {
placeholder: "dd-M-yyyy"
},
dataInit: function(elem) {
$(elem).datepicker({
dateFormat: "dd-M-yy",
buttonImageOnly: true,
buttonText: "Select date",
autoSize: true,
changeYear: true,
changeMonth: true,
showButtonPanel: true,
showWeek: true,
onSelect: (function() {
setTimeout(function() {
this.triggerToolbar();
}, 0);
})
});
}
}
}
jquery 版本:1.9.1
jqGrid 版本:4.5.0
关于 fork,我不确定,它实际上是 liferay 库的一部分,但似乎是免费版本。
这个和my previous question有关,但是有更多的细节和不同的要求
【问题讨论】:
标签: javascript jquery jqgrid