javascript - 当在单元格中显示另一个值时,按一个值对 jqGrid 进行排序?

标签 javascript jquery jqgrid

情况:

$("#CreditLineEditorContent #tabs #PmntDates").jqGrid({
    datatype: "local",
    height: 250,
    colNames: ["Date", "In", "Out"],
    colModel: [
        { name: 'pmntDate', index: 'pmntDate', width: 150, sorttype: "date", sortable:false },
        { name: 'incSum', index: 'incSum', width: 150, sorttype: "float", formatter: 'currency' },
        { name: 'decSum', index: 'decSum', width: 150, sorttype: "float", formatter: 'currency' }
});

我需要按“日期”列对网格进行排序。
问题如下:我有一个 pmntDate 作为 String (例如 02.09.2013),因此它排序为 String,而不是日期

所以,问题是:
如何显示 String 值(例如 02.09.2013),但按原始值(日期)排序?

最佳答案

尝试 datefmt 选项:

{ name: 'pmntDate', ..., sorttype: "date", sortable:true, datefmt: "dd.mm.yyyy" }

http://www.trirand.com/jqgridwiki/doku.php?id=wiki:colmodel_options

关于javascript - 当在单元格中显示另一个值时,按一个值对 jqGrid 进行排序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18571756/

相关文章:

java - 如何在 jqgrid 响应方法中转换元素?

jquery - Jqgrid列标题和数据未对齐

javascript - 如何使用 JQuery SlideDown 平滑地放下图像?

jquery - 在 jquery 中使用 .load 发送多个变量

javascript - 在 Webpack 中订购多个入口点

javascript - block 分割中的自定义模块目录在 Webpack 中不起作用

javascript - window.location.replace JQuery后触发滚动到顶部

JqG​​rid 多选列表总是在 IE7/8 的编辑模式下选择第一个选项

javascript - JS : How would I display a decrementing value through an html header?(及更多)

javascript - 如何在切换后隐藏 div 15 秒