How to set a default value when using a filter
7 posts
• Page 1 of 1
How to set a default value when using a filterThis page: http://www.xataface.com/wiki/filter shows how to create a filter, which I've done successfully. In the example on that page (http://fueleconomydb.com/index.php?-action=list) some of the pull-down menus have default values other than "All". How do I set a default value for my pull-down filter list?
Re: How to set a default value when using a filterThe default value of a filter reflects the current search query. I.e. this is equivalent to the problem of having a default search/filter for a field.
E.g. Suppose you have a 'year' field and you want, by default, only those records where year=2008 to be shown. My solution for this is to generally add this to the query in the beforeHandleRequest method of the application delegate class.
Then if you had filter=1 for the year, field, you would see 2008 selected by default (and only 2008 would be shown by default. -Steve
Re: How to set a default value when using a filterThanks for the explanation. It worked perfectly and I understand why it worked.
Re: How to set a default value when using a filterThanks Steve. This works for me partially. It sets the default, and allows me to set my own filter, but when i try to explicitely UNFILTER, ie. set the filter to All, it won't take. Instead, it just reverts back to the default filter.
Re: How to set a default value when using a filterThat did it. Thanks Steve.
Re: How to set a default value when using a filterOne more on this, if i may -
At the moment in our database we have zero records of the default filter value. Hence, the result list is not shown and the filter dropdown is not available. I suspect this is not an easy fix, but I just wanted to make note of the scenario. Thanks
7 posts
• Page 1 of 1
Who is onlineUsers browsing this forum: No registered users and 12 guests |