PDA

View Full Version : Store grouping / sorting in 3.2



dpollen
15 Apr 2010, 4:48 AM
Is anyone else having weird issues with Group Stores and Store sorting since upgrading to 3.2?

I'm using stores in the ExtGrid and new records don't seem to get sorted correctly.

Also the group store doesn't seem able to display groups in reverse direction?

What changes have been made to the stores since 3.1?

vladcd
21 Apr 2010, 7:14 AM
Did you try to set the groupDir property to 'ASC' or 'DESC'? Changes are primarily related to multisorting, as the Grouping Store implements it by default. For more specific details I would suggest studying the GroupingStore.js file, especially the sort and groupBy methods, and also the sort method from Store.js.

I didn't study it very well, but at a first glance it seems that the grouping store sorts data the following way: first after the grouping field, second after the sorting field. This makes its behavior a bit strange when using paged grids and remote sorting (remote sorting and multi sorting don't function together for now). However, I didn't study it very well, so someone might prove me wrong.

Hope it helps,
Vlad

fabads
22 Apr 2010, 7:05 AM
Hello,

I had the same issue as dpollen but i think it was because of a misunderstanding.

Suppose we have these kind of data from a db :



12 Apr 2010 12:00 DDD
03 Mar 2010 15:00 BBB
12 Apr 2010 11:50 CCC
12 Apr 2010 13:00 EEE
03 Mar 2010 11:00 AAA
I want a group by date and each group sorted by hour (DESC).
And I want my groups ordered DESC:



12 Apr 2010
13:00 EEE
12:00 DDD
11:50 CCC

03 Mar 2010
15:00 BBB
11:00 AAA
The right code should be :


new Ext.data.GroupingStore({
...
sortInfo: {field: 'time', direction: 'DESC'},
groupDir: 'DESC',
groupField: 'date'});

fabads
22 Apr 2010, 7:09 AM
Oups, I forgot to explain my problem related to the example above.

When I display the column associated to the group (hideGroupedColumn = false) and when I click on the column header, sort has no effect (to continue with my illustration above, if I want for example to sort dates ASC) !

Any idea ?

prophet
14 Jun 2010, 10:51 AM
Wow. That "groupDir" config option really needs to be included in the GroupingStore's documentation!