Initial values of element filter

jaga

New Member
Hello,

I have an issue that I cannot find the solution for. I do have an date element with a range filter enabled for it. I can see the filter in the list view but this is not set.
What I am trying to archive is to have this filter set on some initial values. For example I want to view initially the records on the current month. If the user wants a different time range it can change the filter values or for all records it can simply clear the filter.
In the forum I found the possibility to set the initial values of the filter using the URL:
?co_tank___s_date[value][]=-1 week&co_tank___s_date[value][]=now&co_tank___s_date[condition]=BETWEEN
Unfortunately this is not fitting my needs as the list is accessed from Joomla menu and is not embedded in any article to allow me passing parameters. Moreover the URL will look ugly.
The second possibility that I found is to change the $data->filters on the event onGotFilters, by adding manually the filter information:
$model->filters['join'][] = 'AND';
$model->filters['search_type'][] = 'normal';
$model->filters['key'][] = 'co_tank.s_date';
$model->filters['value'][] = '\'2014-03-19 00:00:00\' AND \'2014-03-26 23:59:59\'';
But this method is doing a background filtering and I cannot change it from the filter exposed in the page (actually it seems that they are conflicting).
The question that I actually have is how can I specify the range filter start / end information programmatic in the same way as the URL passing parameter is doing, values that can be afterwards changed from the UI and are in effect on the clear command.
Thanks and best regards,
Jaga.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top