• Hello Fabrik Community

    Fabrik is now in the hands of the development team that brought you Fabrik for Joomla 4. We have recently transitioned the Fabrik site over to a new server and are busy trying to clean it up. We have upgraded the site to Joomla 4 and are running the latest version of Fabrik 4. We have also upgraded the Xenforo forum software to the latest version. Many of the widgets you might have been used to on the forum are no longer operational, many abandoned by the developers. We hope to bring back some of the important ones as we have time.

    Exciting times to be sure.

    The Fabrik 4.0 Official release is now available. In addition, the Fabrik codebase is now available in a public repository. See the notices about these in the announcements section

    We wish to shout out a very big Thank You to all of you who have made donations. They have really helped. But we can always use more...wink..wink..

    Also a big Thank You to those of you who have been assisting others in the forum. This takes a very big burden off of us as we work on bugs, the website and the future of Fabrik.

Default for filter

FilMar

Member
Can I set somehow a default value for a filter?

I have a list that I want to show directly in a filtered way but give the possibility to also show all lines or with different filtering.

How can I give a default value to a filter (combobox) so that the list directly shows only the filtered records?

Many thanks in advance,

Filip
 
We don't have defaults for filters, unfortunately. It's something I've thought about adding, and maybe I'll take a look at doing it if I have some time this week.

-- hugh
 
You can, via menu item (Fabrik list): add your "filter default" to the "Extra query string" at the bottom of the "Fabrik List Options", e.g. to set your dbjoin element filter to value=4
&table___element_raw=4

The list will be shown filtered but the user can change (or clear) the filter(s).
 
Thanks Troester, that seems to work, partly.

I was wrong, it was no dbjoin but a field and the filter was set to combo

when i set it to &table___element=4 it works
but then I realised I needed to show more then 1 value, and I found the wiki article filter by URL
so i put &table___element[condition]=IN&table___element[value]=4,5
but that is not working for me...

For the moment I created another element with only 2 values, one to hide initialy and one to show initialy and I do the filter like that but it is a work-around
 
The complex query string filters aren't simple, you need to play around testing them on the query string till they do what you expect. Adding &resetfilters=1&fabrikdebug=1 helps, so a) any previous attempts at filtering are cleared form the session, and b) you can see the getData query, and exactly what WHERE clauses are being applied.

-- hugh
 
OK, where getting further, but I still have a strange side-effect

The list is based on a view where I have a status as int (StatusA) (Filter = none) and also as text (status) (wich is used als filter (type combo))
Here the list is called via an article (so there are no &-chars between the filters)

when I use
bcv_lesrooster_current___StatusA[value]=8 bcv_lesrooster_current___StatusA[condition]=<
I get the correct list, but when I choose 'Voorbij' (wich is the same as StatusA=8) in the status-combo I don't get any results back
The clear filter button always gives me the list without the records status 'Voorbij'

When I use
bcv_lesrooster_current___status[value]=Voorbij bcv_lesrooster_current___status[condition]=<>
I get the correct list, but in the status-combo it shows 'Voorbij' (The list shows all record execpt those with status 'Voorbij')
When I push the clear filter button, the list rest the same and the combo is cleared to 'all'
When i choose status 'Voorbij' it shows the correct records
When I push the clear filter button now (after the use of any filter) I get all the records (also those with status 'Voorbij')
I tried to change the Filtertype to multiselect list but then also it shows 'Voorbij' as selected, where it should show all the other as selected.

If I use my work-around (field with only 2 values and a simple filter bcv_lesrooster_current___ToShow=Toekomst)
The list opens filtered and the filter shows 'Toekomst'
the clear filter button returns the full list

The last seems correct to me, but needs an extra field. It is the second situation that throws some questions: The clear filter that not always gives the same result and the filter that shows the wrong info.
 
I think you can only use the conditions which are possible and set in the element's "List View Settings"/Filters to set a "default value" for filter elements in the Fabrik list filter block.
So = (if "Exact match"=yes) and something like contains (if "Exact match"=no) and maybe a range (depending on your element filter settings).

<> or < are no possible conditions in the standard element filtering.
Maybe this will set something in the advanced filters (I didn't test) but combining different filter options (standard, advance, search all) will give unpredictable results.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top