【问题标题】:Is it possible for custom sorting in ExtJS 3.2 for date是否可以在 ExtJS 3.2 中对日期进行自定义排序
【发布时间】:2015-07-09 05:30:13
【问题描述】:

我有一个store,它以dd-MM-yyyy 格式获取日期。我想在我的ExtJS grid 中对这个日期进行排序,这样同月的所有日期都应该一个接一个地显示,而下一个月份的日期应该显示。但正在发生的事情是,在ExtJS 中,所有日期都被视为字符串,所以我得到的输出为01-01-2015 下一个日期是01-02-2015,这是我不想要的。那么是否可以在 ExtJS 3.2 中进行自定义排序?

代码 sn-p:

var memebersListStore = new Ext.data.JsonStore({
    name: 'approverlist',
    autoLoad: true,
    url: 'json/loginLogout.do?Uid=' + userLdapId + '&startDate=' + selectedStartDate + '&endDate=' + selectedEndDate,
    fields: ['weekDate'],
    sortInfo: {
        field: 'weekDate',
        direction: 'ASC'
    },
    listeners: {
        load: function (store, records, options) {
            if (store.getTotalCount() === 0) {
                memebersListStoreGrid.reconfigure(store, columnsTwo);
            } else {
                memebersListStoreGrid.reconfigure(store, columnsOne);
            }
        }
    }
});

有人知道吗?

【问题讨论】:

    标签: java extjs extjs3


    【解决方案1】:

    在字段中你必须定义类型。像这样

     fields: [{name: 'weekDate', type: 'DATE'}]
    

    【讨论】:

    • 感谢您的回复。这样它正在转换为 IST 模式。所以现在我改为 YYY-mm-dd 格式,这样它就需要所有月份的日期。..
    • 你也可以使用 extjs 转换器
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-10-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-07-23
    • 1970-01-01
    相关资源
    最近更新 更多