The 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.
- Code: Select all
function beforeHandleRequest(){
$app = Dataface_Application::getInstance();
$query =& $app->getQuery();
if ( !$_POST and $query['-table'] == 'invoices' and !@$query['year'] ){
$query['year'] = '2008';
}
}
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