我最近将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)