jqGrid Date Filtering and Sorting
I have a jqGrid that presents client side data. One of the fields in the array is a Date field, and it's representation in the client side array is a "LONG" value. I created a customer cell formatter to turn that into a mm/dd/yyyy string. Unfortunately, I cannot seem to get the "searching" and "filtering toolbar" to understand how to search/filter.
I searched around for other answers to this question, to no avail. I did try the "sorttype" function such as:
stype: 'text',
sorttype: function (cell) {
var date = new Date (cell);
return date.getMonth().toString() + '/' + date.getDate().toString() + '/' + date.getFullYear().toString();
}
but that did not work either. If anyone has any tips or points, I would greatly appreciate the help. Thanks in advance.
Edit:
The exact definition for the column is:
,{
name: "Original_Delivery_Date",
align: 'center',
formatter: cellDateFormatter,
editable: true,
sorttype: 'int'
}
Here is the formatter I use:
/**
* Converts from a LONG date (1318636800000) to YYYY-MM-DD format.
*/
function cellDateFormatter (cellValue, options, rowObject) {
if (cellValue == null || cellValue == '') {
return '';
}
var dt = new Date (cellValue);
return (dt.getUTCMonth () + 1) + '/' + dt.getUTCDate () + '/' + dt.getUTCFullYear ();
}
链接地址: http://www.djcxy.com/p/25952.html
上一篇: 性能客户端jqgrid与服务器端jqGrid之间的差异
下一篇: jqGrid日期过滤和排序