filter=1 in fields.ini sort order

A place for users and developers of the Xataface to discuss and receive support.

filter=1 in fields.ini sort order

Postby tomhousley » Wed Oct 21, 2009 11:57 am

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
tomhousley
 
Posts: 52
Joined: Thu Feb 26, 2009 1:02 am
Location: United Kingdom

Postby shannah » Thu Oct 22, 2009 9:06 am

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
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby tomhousley » Thu Oct 22, 2009 2:35 pm

That's great, thanks Steve.

Added it to the wiki: http://xataface.com/wiki/filter
tomhousley
 
Posts: 52
Joined: Thu Feb 26, 2009 1:02 am
Location: United Kingdom

Re: filter=1 in fields.ini sort order

Postby ADobkin » Sat Mar 31, 2012 3:17 pm

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
ADobkin
 
Posts: 195
Joined: Mon Oct 22, 2007 7:31 pm
Location: Atlanta, GA, USA

Re: filter=1 in fields.ini sort order

Postby shannah » Mon Apr 02, 2012 9:37 am

I don't think so currently.
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 20 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved