Hello,

I have a view. The style is HTML List (unordered). The Grouping field is set to a CCK content field.

The CCK Content field is a select list with three items. My question is: what determines the sort order of the groups?

The select list used to have two options.

Hot
Not

I added a third to the top.

Very Hot
Hot
Not

The view ordered the groups as:
Hot
Very Hot
Not

Which is neither in alphabetical order nor the order they are listed in the select list. I'd like to know how Views determines the order in which the groups appear, and if that can be adjusted somehow. Any assistance would be greatly appreciated.

Comments

merlinofchaos’s picture

Status: Active » Fixed

Groups are sorted in the order they appear in the resultset.

It is often a good idea to use the grouping field as part of the sort, if you can, to ensure that the groups sort the way you like.

For exmple, let's say I'm doing a view, grouping on node type, and I come up with a resultset that looks like this, sorted by nid:

nid | title | type
1      A       story
2      B       page
3      C       story
4      D       article
5      D       article

Then the groups would be in this order: story, page, article --

mehoo462’s picture

Perfect! Thank you.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Cablestein’s picture

I have the same issue.

This module can give you some control of the sorting of field groups:
http://drupal.org/project/views_groupby

After some tinkering, I had my groups in the order I needed.