小编Mic*_*l P的帖子

EXTJS 5:如何在EXT JS 5中对网格列进行排序

我最近将EXT JS的版本更新为5,并且覆盖doSort功能不再有效.有人在想怎么办?

覆盖范围:

{
    text: 'Custom',
    sortable : true,
    dataIndex: 'customsort',
    doSort: function(state) {
        var ds = this.up('grid').getStore();
        var field = this.getSortParam();
        ds.sort({
            property: field,
            direction: state,
            sorterFn: function(v1, v2){
                v1 = v1.get(field);
                v2 = v2.get(field);

                return v1.length > v2.length ? 1 : (v1.length < v2.length ? -1 : 0);
            }
        });
    }
}
Run Code Online (Sandbox Code Playgroud)

编辑1: 我只是尝试@tomgranerod的解决方案,但me.sortState始终是'undefined'.所以我这样做来更新我的变量:

    sort: function () {
        var me = this,
            grid = me.up('tablepanel'),
            store = grid.store;

        me.sortState = me.sortState === 'ASC' ? 'DESC' : 'ASC';

        Ext.suspendLayouts(); …
Run Code Online (Sandbox Code Playgroud)

javascript extjs extjs5

5
推荐指数
1
解决办法
2万
查看次数

标签 统计

extjs ×1

extjs5 ×1

javascript ×1