extjssortable不按大小写和日期排序

extjs sortable does not sort on case and dates

本文关键字:日期 排序 大小写 extjssortable      更新时间:2023-10-23

我有一个extjs网格,它有一个电子邮件字段,其中的电子邮件以大写和小写开头。此字段未按应有的方式排序。

此外,我有一个格式为2012年6月14日上午11:00的日期字段。

我不知道如何按升序/降序对日期列进行排序。

我的意思是网格确实对数据进行了排序,但它没有正确地对进行排序

这是我的代码:

var init_groupView = function() {
    userStore = new Ext.data.Store({
        url: 'scripts/users_getAllUsers.cgi',
        reader: new Ext.data.JsonReader({
            root: 'users',
            totalProperty: 'usersCount',
            id: 'user_id',
                 fields: [ 'fullname','email','login_time']
        })
});

以下是我的列的排序方式。

columns: [
            {header: "Full Name", width: 150, height:16, sortable: true, dataIndex: 'fullname'},
            {header: "E-Mail", width: 200, height:16, sortable: true, dataIndex: 'email'},
            {header: "Last Login", width: 150, height:16, sortable: true, dataIndex: 'login_time'}
]

您需要在字段上设置类型,以便它知道如何对值进行排序:

http://docs.sencha.com/ext-js/2-3/#/api/Ext.data.Field-cfg-type

您可能还需要设置dateFormat配置。