PDA

View Full Version : [INFOREQ] sorting problem on Ext.grid.column.Column -> sort without direction [ExtJS 4.2.5]



anto.poerio
9 May 2017, 1:35 AM
Ext version tested:



Ext 4.2.5




Browser versions tested against:



Chrome 57.0.2987.133



Description:



There is an error on toggleSortState method implementation on Ext.grid.column.Column: the sort method is invoked without direction param.



Steps to reproduce the problem:


Click on sortable column header



The result that was expected:


Column sorted on each header click alternating ASC and DESC sorting



The result that occurs instead:


No sorting is applied



The default implementation:



toggleSortState: function() {
var me = this,
idx, nextIdx;
if (me.sortable) {
idx = Ext.Array.indexOf(me.possibleSortStates, me.sortState);
nextIdx = (idx + 1) % me.possibleSortStates.length;
me.sort();
}
}


I fix this modifying the method with:



toggleSortState: function() {
var me = this,
idx, nextIdx;
if (me.sortable) {
idx = Ext.Array.indexOf(me.possibleSortStates, me.sortState);
nextIdx = (idx + 1) % me.possibleSortStates.length;
// update sortState value
me.sortState = me.possibleSortStates[nextIdx];
me.sort(me.sortState);

// adding css class to the header
me.setSortState({
direction: me.sortState
});
}
}


I think it should work in that way... Any suggestion?

Gary Schlosberg
9 May 2017, 2:05 PM
Are you seeing an error in behavior due to this?

anto.poerio
9 May 2017, 2:20 PM
Are you seeing an error in behavior due to this?

Today, have been done some test on columns sorting by header clicks. It seem to work correctly with this fix.