Closed (won't fix)
Project:
Views (for Drupal 7)
Version:
6.x-2.0-beta2
Component:
User interface
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
28 Apr 2008 at 18:19 UTC
Updated:
17 Sep 2012 at 10:02 UTC
Jump to comment: Most recent file
Comments
Comment #1
merlinofchaos commentedUnfortunately, this is not possible because the terms are not actually part of the query. They are pulled up from a second query, and there is no way to accomplish what you ask.
Comment #2
matt_paz commentedcontent_taxonomy should provide a sideways approach to dealing with this issue when it is ported to 6 ... it allows you to store a snap shot of the term name in a text field (in addition to storing in a proper term_node relationship) which should be sortable in views ... I think that would address the needs of those looking to sort on a taxonomy term. The denormalized snapshot can come in handy in other areas too.
Comment #3
merlinofchaos commentedDenormalized data is fun! That sounds like a great solution.
Comment #4
matt_paz commentedOkay, so should revise my earlier recommendation regarding content taxonomy. Seems it is intended to completely replace taxonomy rather than augment it, so I think we've decided it may be more trouble than it is worth, but still remain a little undecided. As a result, I've been working towards a more primitive solution. I've added cck text fields for taxonomy items that I want to denormalize for use in views. Then I use hook_nodeapi to update the fields I want and hook_taxonomy to update all references to those fields should a taxonomy item change. Seems to be working pretty well so far, but augmenting normalized data w/ denormalized data can prove "interesting" ... I'll probably add a cron job to help w/ additional clean up just in case. If anyone has additional thoughts or commentary, I'd be interested.
Thanks!
Matt
Comment #5
nimrod98 commentedInstead of sorting it, perhaps you can choose to filter by taxonomy terms and expose it. Just a thought =)
Comment #6
vthirteen commentedfor those who will choose to sort through Content Taxonomy, a few instructions to make the field sortable (using a relationship in views):
http://drupal.org/node/272424#comment-1254224
Comment #7
bartezz commentedWithout smilies I'm not sure how to read your post Merlin, but I take it it was meant as an sarcastic post.
I've tried finding out why you don't think it's a good solution but I can't really see why.
We would like to sort a table by a taxonomy term. I know this isn't possible due to the complexity of the query and such (read this post too).
But Content Taxonomy as described in this post is the only possible solution I have found so far to sort on taxonomy terms.
Could you tell me why this isn't a good solution, and if there is a possible other solution through other ways/modules?
Thank you
Comment #8
xenophyle commentedI hope I'm not breaking some rule by responding to a post that is not only old, but "won't fix"...
But I am curious: would it be possible to do this using JavaScript, i.e. clicking on table headers, rather than by server request?
Comment #9
merlinofchaos commentedIt would be possible but it doesn't exist as a simple tool you can plug in. But there is javascript out there that can do it pretty easily so it wouldn't take too much to do it just on your site.
Comment #10
bartezz commentedThe best Jquery/Javascript table sorter I know of: http://tablesorter.com/docs/
Cheers
Comment #11
eiland commented...but that wont work of course if your table is longer than one page :(
Filers do work but it stays less elegant.
Comment #12
jaapjan commentedI know this issue is closed, but maybe this will help others fix this problem.. You can fix this by using the module views_php: http://drupal.org/project/views_php It isn't necessary to install content_taxonomy. Even paging will work. I use Views 6.x.3.. but it will probably work for Views 6.x.2 too.. Just setup the view by following these steps:
1) Install views_php
2) Edit the view and make a relationship: "Taxonomy: terms on node" and select the desired vocabulary name.
3) Add a field: Taxonomy term and select the newly created relationship from step 2. If you want to you can decide not to display this field..
4) Add a field: Global -> PHP and return the value from the field created in step 3 in "value code". Be sure to follow the steps in 5 and 6 before saving this field.
5) Enable click sort by selecting "sort alphabetically". Return the value from the field created in step 3.
6) Output the code by printing the value from the field created in step 3. Save the field.
7) Enable sorting in this table column by editing the table settings.
See the attached screenshot for setting up the php field.