Posted by molnitza on October 7, 2011 at 10:52pm
5 followers
| Project: | Address Field |
| Version: | 7.x-1.x-dev |
| Component: | Code |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (works as designed) |
Issue Summary
At the time it is not possible to sort by the address fields. I use the address field in a views and rewrite the output with a token. At the end of the form (click sort column) I had chosen the same as the token.
Comments
#1
I attached a screenshot of the sorting options for segments of the addressfield. This is implemented in Views, not directly in Address Field; so you shouldn't have to use tokens as a work-around.

#2
I have this problem as well - the issue isn't with the "sort criteria" option in the view - that works fine. The issue is when creating a table view, and enabling click sorting on the table view, click sorting on the addressfield column doesn't work properly. It won't sort by the actual contents of the addressfield column.
#3
Thought I could get around it by creating a "Global: Custom text" field using the string value AddressField location [tokens], but unfortunately custom text fields are not sortable.
#4
Here's a screenshot of the incorrect sorting of this type of field. Assume it's sorting by the first value (in my case "organization").
#5
Yep, mine is doing the same as #4 - I can't figure out what it's sorting on though, as my address doesn't store names or organizations.
#6
This is an active and big problem.
#7
In order to workaround this, I used auto_nodetitle to replace the node titles with the piece of the location I wanted to sort by (in my case, city) and used node title for the sort field in the view. This probably wouldn't work for most cases but it was a reasonable workaround for me.
#8
The status of this should be "active" since "needs work" means there is a patch that needs work.
#9
Ok, I think I understand what's happening here. The issue appears to be that folks are adding an address field column to a View, rewriting the output to only show part of the address, and then expecting a click sort to sort based on the rewritten output instead of the data in the field itself. Unfortunately, that just isn't possible. Views sorting happens at the query level before the View results are ever rendered and output is rewritten. There's no way for a click sort to take into consideration just a specific part of the address when the column itself is a full address field.
If I end up committing it, this will provide the solution: #991834: Address component Views support
#10
Quite right. That's exactly it.