我使用jqGrid在用户界面中显示记录,并希望对日期列进行排序。它以Sat, Sep 1, 01:41 AM的形式返回日期。我怎样才能用jqGrid做到这一点?
我对该专栏的Colmodel是:
{name:'transactiontime', index:'transactiontime',  sorttype:'text', align:"right"},发布于 2012-09-18 04:15:13
尝试以下formatoptions
{name: 'transactiontime', sorttype: 'date', align: "right", formatter: 'date',
    formatoptions: {srcformat: 'ISO8601Long', newformat: 'D, M d, H:i A'}}查看the demo,这是对the answer演示的简单修改。
srcformat可能取决于数据的输入格式。
发布于 2012-09-18 02:03:02
使用sorttype:'date'和datefmt:
datefmt控制日期(当日期类型设置为local时)和编辑规则{ sorttype:date:true}字段的格式。它确定该列的预期日期格式,并使用类似PHP的日期格式。当前为“/”、“-”和“”。支持用作日期分隔符。有效格式为:
当然,您也可以在服务器端进行排序,如果这样做更容易的话。您可以在服务器端使用sidx和sord字段。
https://stackoverflow.com/questions/12455337
复制相似问题