If I create a table with Views and add a "Context Taxonomy Field" as "Field", the table is not sortable.

This makes sense, if you got a multi-term vocabulary.
But if you choose "Number of values" = 1 and deactivate "Multiple select", sorting should be possible, because there can be only one term per column.

CommentFileSizeAuthor
#5 content_taxonomy_320349.patch1.13 KBdrewish

Comments

michalkar’s picture

Hello All

I am at the same point. I am waiting for any advices and if I develop something I will publish.

Michal

mh86’s picture

the current views support doesn't join on the term_data table. it just selects the term ID out of the cck table. in a formatter function taxonomy_get_term is called on the term ID and the term name gets returned.
this is definitely not optimal, but it was very easy to implement, because I just could reuse the whole CCK's views integration.
before an official release, this has to be fixed. I appreciate when someone starts working on this issue

Anonymous’s picture

If i knew how to code it i would help :) Give me twenty years...

But in the meantime i would like to add my support for this feature, as since moving from D5 to D6, i am no longer able to sort half my views.

drewish’s picture

subscribing... i might have some time to work on this next week.

drewish’s picture

Title: Make Content Taxonomy fields sortable in Views » Add a views relation and make Content Taxonomy fields sortable
Status: Active » Needs review
StatusFileSize
new1.13 KB

Talked to merlinofchaos on IRC about doing the sorting and he pointed out that we should be able to use the field's relation to get it sorted... but *doh*! we don't have a relation from the CCK field to the term_data table. The attached patch adds one which allows us to use the built in taxonomy sorting. We might get some other features for free but I haven't checked yet.

drewish’s picture

Title: Add a views relation and make Content Taxonomy fields sortable » Add a views relation so Content Taxonomy fields can use built-in taxonomy code

okay turns out that #294995: CCK Content taxonomy + Views + Term name argument is now a dupe of this because with the relation you can use view's built-in taxonomy handlers for arguments.

drewish’s picture

also marked the following as duplicates since this patch will address them:
#339201: Display title as link
#279462: Allow fields to be sortable in views

mikeytown2’s picture

Subscribing
If using multiple tags per field can it use the top tag, instead of it not being sorted? Kinda like the way it works with tokens?

mh86’s picture

Status: Needs review » Fixed

Hi all!

I committed the patch from #5. This is really awesome, I never though it's going to be that easy to get these features... in the drupal 5 version I had to write lots of code for the arguments..
thanks a lot!

drewish’s picture

sweet! looking forward to the next official release ;)

Status: Fixed » Closed (fixed)

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

sugreen’s picture

Version: 6.x-1.x-dev » 6.x-1.0-rc2
Category: feature » bug
Priority: Normal » Major
Status: Closed (fixed) » Active

hi,

sorry for my english.

in patch on line:
+ 'field' => 'tid',

should be:
+ 'base field' => 'tid',

is it right?