【发布时间】:2018-02-02 18:57:54
【问题描述】:
我有一个带有缓冲存储的 EXTJS 网格。我在这家商店启用了 remoteSort: true。有几个列被标记为可排序的:true。但是每次我单击任何列进行排序时,所做的后端调用仅包括存储中提到的排序列和方向。前任。即使我点击 Col2 或 Col3 进行排序,后端的 GET 调用总是包含 'sort: col1, direction: desc',如 '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
}]
});
我怎样才能让这个网格按点击的任何可排序的列排序?
【问题讨论】:
标签: javascript sorting extjs grid store