I tried making the change, but it did not help. As it is not a serious problem, I left it for a while, but have now had another look.
The code that shows the “Clear filters” button is in both
components/com_fabrik/views/list/tmpl/bootstrap/default_buttons.php and
components/com_fabrik/views/list/tmpl/div/default_buttons.php
at line 51:
PHP:
if (($this->showClearFilters && (($this->filterMode === 3 || $this->filterMode === 4)) ||
$this->bootShowFilters == false)) :
It is always true if bootShowFilters is false, i.e. if Filter mode is “No” and there is no Table search all filter.
Also, it is true if there is at least one Element filter defined and Filter mode is “Under headings” or “Under headings (toggleable)”. (In the “Under headings (toggleable)” setting, it is true regardless of the toggle state.)
As I was getting somewhat confused, I checked, with the original code in place, what happens in the various filter modes for a form with element filters and for one with none. In each case, for mode zero, the action seems incorrect; the Clear filters button is displayed (and is active), despite there being no Filter button and no filters.
In addition, in mode 4 with element filters defined, although the Clear filters button is displayed correctly, it might be nice if it was hidden along with the filters themselves when they are toggled off, although in this case there is a filters button showing, so the Clear filters button does not look so odd. The mode 5 case is similar; the button could toggle off when the pop-up is open, although it only duplicates the clear filter link in the pop-up. After spending a while on this, I did not feel like digging into the Javascript to see if anything could be done to make a small improvement!
I would have included tables here, showing all states, but could find no way of doing so.
I also checked what happens when the Table search all filter is defined, both with and without element filters being defined. With the Table search all filter defined, in filter modes (including toggleable ones) where neither the Clear filters button nor the Clear filters link is displayed, the Clear filters button is not added (except in mode zero where it is currently added anyway, I think erroneously). I think it should be added in these cases.
The unwanted Clear filters button in filter mode zero appears to be due to the effect of bootShowFilters, so I had a look at that. The code for it is in
views/list/view.base.php at line 615:
PHP:
$this->bootShowFilters = (count($fKeys) === 1 && $fKeys[0] === 'all') ||
$this->filterMode === 0 ? false : true;
It is always true for modes other than “No” and it is always true if there is a Table search all filter. It is false only if there is no Table search all filter and the mode is “No”.
I found that bootShowFilters is used in
components/com_fabrik/views/list/tmpl/bootstrap/default.php
components/com_fabrik/views/list/tmpl/bootstrap/default_buttons.php and
components/com_fabrik/views/list/tmpl/div/default_buttons.php
all at line 51. These are the places that cause display of the Clear filters button and bootShowFilters is used to determine when there is a table filter defined. Filter modes are checked in each place it is used and the check for mode zero in the code for bootShowFilters is counterproductive. bootShowFilters seems to be used nowhere else.
I suggest the code that sets it up could be revised to:
PHP:
$this->bootShowFilters = (count($fKeys) === 1 && $fKeys[0] === 'all');
and that the code in both
components/com_fabrik/views/list/tmpl/bootstrap/default_buttons.php and
components/com_fabrik/views/list/tmpl/div/default_buttons.php
at line 51 be modified to:
PHP:
if ($this->showClearFilters && ($this->filterMode === 3 || $this->filterMode === 4) ||
($this->bootShowFilters && ($this->filterMode === 0 || $this->filterMode === 2 ||
$this->filterMode === 5)) || (!$this->showClearFilters && $this->bootShowFilters)) :
When I tried these modifications, the various problems seemed to be solved and no new ones appeared, although my testing was not exhaustive.
I then noticed some discrepancies with what is displayed for the Table search all filter in the various modes; these occur with the original code as well as with my modifications. Having run out of time, I decided to report my findings so far to see if anyone has any comments; I will look further when I can find the time.