Page 1 of 1
filter=1 in fields.ini sort order
Posted:
Wed Oct 21, 2009 11:57 am
by tomhousley
Hello,
Can I - and if so - how do i specify a sort order when I use filter=1 in fields.ini?
Currently I think it's sorted by the primary key, but I would prefer it to be sorted alphabetically.
Many thanks, Tom
Posted:
Thu Oct 22, 2009 9:06 am
by shannah
The items are sorted by the field value that it is working with. If you are filtering on a field where an ID is stored in the DB but you are using a vocabulary to associate it with a value, then it will still be sorted on the ID.
If you want to sort on value then you should add a grafted field with the value using the __sql__ directive of the fields.ini file, then use that grafted field as your filter field.
E.g.
__sql__ = "select a.*, b.foo_name from a left join b on a.foo_id=b.foo_id"
[foo_name]
filter=1
Best regards
Steve
Posted:
Thu Oct 22, 2009 2:35 pm
by tomhousley
That's great, thanks Steve.
Added it to the wiki:
http://xataface.com/wiki/filter
Re: filter=1 in fields.ini sort order
Posted:
Sat Mar 31, 2012 3:17 pm
by ADobkin
Is it possible to sort the filter selection list in reverse (descending)?
This is particularly an issue for date fields, since the latest dates are at the bottom of the list by default.
Thanks,
Alan
Re: filter=1 in fields.ini sort order
Posted:
Mon Apr 02, 2012 9:37 am
by shannah
I don't think so currently.