PDA

View Full Version : [FIXED] Grid sorting not work when grouping feature is on



darkside_ua
11 Jun 2011, 6:37 AM
I have a grouping feature on a grid with grouping by 'groupdate' column. The store is configured to use 'simpleSortMode: true'.

So, when the grouping is enabled and I'm trying to sort grid by different columns by clicking on them, the sorting won't work because the 'sort' parameter sent to backend is always 'groupdate' no matter what column I have clicked.

If I disable grouping feature the sorting works just fine.

hjones
18 Oct 2012, 12:11 PM
Amazed me that this is still broken in 4.1.2.
Here's a fix...



Ext.define('Ext.data.proxy.Server', {
override: 'Ext.data.proxy.Server',

getParams: function(operation) {
var me = this, groupers = operation.groupers,
sorters = operation.sorters,
groupParam = me.groupParam,
sortParam = me.sortParam,
simpleGroupMode = me.simpleGroupMode,
simpleSortMode = me.simpleSortMode,
directionParam = me.directionParam,
params = me.callParent(arguments);

if (sortParam && sorters && sorters.length > 0) {
if (simpleSortMode) {
//--------START FIX
var index = 0;
if (sorters.length > 1 && groupParam && groupers && groupers.length > 0)
index = 1;
//--------END FIX
params[sortParam] = sorters[index].property;
params[directionParam] = sorters[index].direction;
}
}

return params;
}
});