simone960's picture

I wonder how to sort a taxonomy field (term reference) in the Views table not by the ID but by the alphabetic order whichever the term name is. e.g Author, Issue. 

To explain this further, here what I do, let say:

1) Create a content type called "Book"

2) Added some fields, one of them is "Issue" and another is "author" and both are "Term reference".

3) Created a table in Views, and in the table settings, make the headings for Author and Issue sortable.

4) When I click on the "Author" or "Issue" headings, the sorting wasn't correctly sorted in alphabetical order. 

 

Can anyone check it out and let me know how to resolve this. Thanks!

 

 

Most helpful answers

I have done something similar. Since the View is a content view, you need to add a relationship to the "Issue" field (and "Author" field I suppose) and then you should have access to a "(Issue) Term name" under the Sort settings.

Let me know if that's not clear and I can try to expand on it.

EDIT: Here's a screenshot of what I mean

Comments

klonos's picture

Hello  👋

It would be easier of you could export the view configuration (perhaps also the content type config and the vocabulary config), and then post it somewhere like a public gist, then link to the gist here.

That way, those of us that want to help could import the configuration on a test site, play with it, and possibly come up with a solution for you.

Alternatively, perhaps do that in a sandbox site. See https://backdropcms.org/demo (take note of the link to the site, the username and the password - also be aware that the sandbox is deleted after 24hrs).

simone960's picture

You are right ! It's actually quite difficult to explain in words sometimes.

Alternatively, perhaps do that in a sandbox site. See https://backdropcms.org/demo (take note of the link to the site, the username and the password - also be aware that the sandbox is deleted after 24hrs).

The backdrop sandbox is great ! It's very convenient to test out different cases quickly. Great tool! Thanks for sharing !

I have done something similar. Since the View is a content view, you need to add a relationship to the "Issue" field (and "Author" field I suppose) and then you should have access to a "(Issue) Term name" under the Sort settings.

Let me know if that's not clear and I can try to expand on it.

EDIT: Here's a screenshot of what I mean

simone960's picture

Thanks @laryn!

I tested using the relationship you pointed out and it works for me! For my case I actually wanted to show them as fields and sort them by table format. But your method basically works for both situations. Wonderful ! Thanks !

Sort term reference field in Views