PDA

View Full Version : GridPanel - Sort by GroupingSummary



undeclared
21 May 2014, 1:23 PM
I am having an issue where I setup a sorting function in my store, but what happens is that it prefers the higher value, not the summarized higher value.

Groupers in my store:


groupers: [ {
property: 'groupName',
sorterFn: function(o1, o2)
{
if (o1 == o2) return 0;
if (o1 > o2) return -1;
if (o1 < o2) return 1;
}
}
]


What occurs is the following:

I have lets say 5 records belonging to 2 groups:

group 'abc' has a 2 records, one has a 'number' value of 5, the other has a number value of 5000 (number total: 5005)
group 'bcd' has 3 records, each record has a 'number' value of 2000 (number total: 6000)
What happens is that it sorts by the highest 'number', so group 'abc' is on top, while 'bcd' is below, even though 'bcd' has a bigger total.

Does anyone know how to fix this issue? Or how I should be doing this properly?

Any help is greatly appreciated. Thanks!

Gary Schlosberg
23 May 2014, 2:55 PM
This example from the docs seems to sort based on the summary totals:
http://docs.sencha.com/extjs/4.2.1/#!/example/grid/remote-group-summary-grid.html

undeclared
23 May 2014, 5:42 PM
I am calling your answer the best one, however then it appears there is no local way of doing this. That really needs to be fixed and addressed.

undeclared
16 Jun 2014, 1:59 PM
I wish to re-open this thread, it doesn't work. I have tried everything, and it will not sort by Grouping Summary no matter what. Remote or local.