PDA

View Full Version : How can I change how Groups themselves are sorted?



richardtallent
26 Sep 2011, 2:10 PM
I have a grid grouped by a particular column, but I need the groups to not be sorted alphabetically -- the groups are steps in a process, and the steps don't happen in alphabetical order.

I can have add an extra column to the Model with the group's sort order, but then if I group on that column, I can't access the group name's column in the "groupHeaderTpl" template.

How can I group by one field, but show another field in the group header?

Or, barring that, I can combine the group sort order (zero-padded) and name into a single data column, but what is the syntax for "groupHeaderTpl" to have it return a substring of {name} rather than the full value?

skirtle
27 Sep 2011, 1:26 AM
Internally groups are handled the same as sorting. I haven't tried it but I'd have thought you could do this by playing with a custom Grouper. Maybe a sorterFn or a transform?

http://docs.sencha.com/ext-js/4-0/#!/api/Ext.util.Grouper

Give it a go and let us know how you get on.

abcdef
5 Oct 2011, 12:34 AM
Did you find a solution to this one?

My situation is similar:

The groups contain the right items - accomplished by specifying the field to group by, but the groups themselves need to be visually ordered in a grid panel by the end time of the last of the steps that the group contains.

Any pointers on how to achieve this?

Thanks!