2017-08-24 44 views
1

我有一个EXTJS网格,它有一个缓冲存储。我已在此商店中启用remoteSort:true。有几列被标记为可排序:true。但每次点击任何列进行排序时,所做的后端调用仅包括商店中提及的分拣机列和方向。防爆。即使我单击Col2或Col3进行排序,GET调用后端始终包含'sort:col1,direction:desc',如'sorters'中所述。ExtJS 5.0:网格remoteSort总是按默认的'sorters'排序

商店:

Ext.define('MyStore', { 
    extend: 'Ext.data.BufferedStore', 
model : 'MyModel' 

    pageSize: 200, 
    autoLoad: false, 
    leadingBufferZone: 200, 
    trailingBufferZone: 200, 
    remoteSort: true, 
    sorters: [{ 
    property: 'col1', 
    direction: 'DESC' 
    }], 

    proxy: { 
    type : 'rest', 
    format: 'json', 
    url : '/my_app/my_controller/list', 
    extraParams: { 
     someparam: '', 
     otherparam: '' 
    }, 
    reader: { 
     type: 'json', 
     rootProperty: 'data', 
     totalProperty: 'totalCount' 
    } 
    } 
}); 

网:

Ext.define('MyPanel', { 
    extend: 'Ext.grid.Panel', 
    requires: [ 
    'MyStore' 
    ], 
    initComponent: function() { 
     this.store = new MyStore(); 
     this.callParent(arguments); 
    }, 
    columns: [{ 
     text: 'Col1', 
     dataIndex: 'col1', 
     width: 150, 
     sortable: true 
    },{ 
     text: 'Col3', 
     dataIndex: 'col3', 
     width: 150, 
     sortable: true 
    },{ 
     text: 'Col3', 
     dataIndex: 'col3', 
     width: 250, 
     sortable: true 
    }] 
}); 

我怎样才能使这个电网通过点击任何可排序的列进行排序?

回答

1

您已经明确设置了simpleSortMode,并且文档已经提到了问题所在。

您已经设置了第一个分拣机,并且按列点击排序后添加了第二个分拣机,但是当simpleSortMode被激活时,只有第一个分拣机被发送到服务器。

+0

感谢您的更正。我删除了simpleSortMode:true,但我仍然看到相同的问题。使用remoteSort:true和sorters提到,通过列点击排序仍然只使用分拣机。此外,我尝试remoteSort:false(只启用本地排序),并完全禁用排序。 – KavitaC

+0

你能提出一个解决方案吗? – KavitaC

+0

[我做了一个Sencha小提琴](https://fiddle.sencha.com/#view/editor&fiddle/25t7),发现原因是5.0.0中的一个问题。该错误在5.0.1中得到解决,您应该考虑进行框架升级。 – Alexander