Drupal 6.15.
Hi,
I hope I post at the right place.
I need help.
I tried to figure out how to add Sort (when clicking on the title) for Content Taxonomy Fields and Node reference.
Here's the situation.
I have a node "apartement". With the CCK I added some fields like Price (integer), Description (text), Location (node reference), Size (Content Taxonomy Fields) Availability Date (date).
In the Basic settings of my view, Style = Table.
When I click on the gear, I can decide which column is sortable for Price (integer), Description (text), Availability Date (date) BUT I AM NOT ABLE to do that for Location (node reference) and Size (Content Taxonomy Fields).
How can I add a sort for that column?
Which hook should I use?
Which is the appropriate method?
I have read this post: http://drupal.org/node/495402 but it not help me too much.
I have also read the documentation about tablesort.inc: http://api.drupal.org/api/drupal/includes--tablesort.inc/6
I really don't know where to start. I am looking for a complete example. Maybe someone can give me some tips.
Thank you.
Comments
How to add sort for content taxonomy fields
Hi Agaron,
Try the following
1. Add a relationship for your content taxonomy field (click the + in "relationships" and choose content:Size or similar)
2. Add a field in your table that is Taxonomy:Term (and not content:Size). In the Relationship: drop-down, choose "content:Size term" or something similar (whatever you called your relationship in step 1.). Set up the rest of your field as usual.
3. Click the options symbol right next to style:table in the "basic settings" section. You will see a list of fields and there should be a "sortable" checkbox next to field you just added. Check it and save.
Your field should now be sortable by clicking on the table headers.
I have not tried it with node reference but I suspect it might work as well, if you get the right combination of relationships.
Hope this helps,
Delphine
Thanks for help
Thanks for help
Thanks Pimousse98 !! your
Thanks Pimousse98 !! your explanation is extremely clear and helped me a lot
Thank you
Great this worked for me.
Dev Dave UK
Thanks!
I searched quite a bit to find this.
Views 2, Node Reference fields, Table Sort.
Thanks very much!
Kevin