0

I have a list field (category) associated with content type

Fruit|Good Fruit Meal|Fantastic meal Thai Coffee|Coffee

In views, I used sorting as category ascending. Now, I expected result to be sorted as: Coffee, Fantastic meal and Good Fruit. BUT it is sorting using value of list item as: Fruit, Meal and Thai Coffee.

Is there any way I can sort it using list item text but not with list item value?

Thank you.

1

1 Answer 1

1

The best way to accomplish this is to use a term reference field rather than a list field, for a number of reasons:

  • The taxonomy module is made specifically for categorizing things, so it's a natural fit for a "Category" field.
  • You don't have to edit your Category field every time you want to add options; you can simply add more taxonomy terms. This is better for Features-driven development (assuming you've exported your fields to code).
  • You can sort by the taxonomy terms' titles in Views by using a Views relationship between the node and the term via the term reference field.

AFAIK, there is no way to sort by value labels in a list field like you're trying to do. I'd definitely recommend going with a term reference field instead.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.