Twitter Feed

Xataface Maillist

Sign up to receive the Xataface news letter with weekly updates and development tips.

Found 1 of 138 records in table Wiki
Now Showing 1 of 1

Current Record: filter



The filter attribute of the fields.ini file

The filter attribute with a value of 1 specifies that a field should be used as a filter field in list view. In list view, any filter fields will provide a select list with all of the possible values in that field. Selecting one of the items in this list will filter the results to only show records of that value.

Example 1: Year, Make, Model

The Fuel Economy Database has three fields with filter=1 : Year, Make, and Model. I.e., in their fields.ini file we have something like:




This causes 3 select lists to appear in list view. See the application here and notice the select lists for Year, Make, and Model just above the list of results.

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, like the following:

__sql__ = "select a.*, b.foo_name from a left join b on a.foo_id=b.foo_id"

blog comments powered by Disqus
Powered by Xataface
(c) 2005-2019 All rights reserved