Reset Filters doesn't work

twistedhardware

New Member
Hi,

I'm using the content plugin to show a list with a filter under a form:
{fabrik view=list id=36 crm_purchaseorderline___PurchaseOrder=[rowid]}

I receive in header
"Set crm_purchaseorderline___PurchaseOrder=XX"
Where XX is the rowid

I checked the source code and found this:

/components/com_fabrik/controllers/list.php

PHP:
    protected function _setRequest($unused)
    {
        $app = JFactory::getApplication();
        $input = $app->input;

        /*
         * $$$ hugh - in order to allow complex filters to work in lists, like ...
         * foo___bar[value][]=1 foo___bar[value[]=9 foo___bar[condition]=BETWEEN
         *we have to build a qs style array structure, using parse_str().
         */
        $qs_arr = array();
        $qs_str = implode('&', $unused);
        parse_str($qs_str, $qs_arr);
        $this->origRequestVars = array();
        foreach ($qs_arr as $k => $v)
        {
            $origVar = $input->get($k. '', 'string');
            $this->origRequestVars[$k] = $origVar;
            $_GET[$k] = $v;
            echo "set $k = $v <br>";
            $input->set($k, $v);
        }
        /*
         * $$$ rob set this array here - we will use in the tablefilter::getQuerystringFilters()
         * code to determine if the filter is a querystring filter or one set from the plugin
         * if its set from here it becomes sticky and is not cleared from the session. So we basically
         * treat all filters set up inside {fabrik.....} as prefilters
         */
        $input->set('fabrik_sticky_filters', array_keys($qs_arr));
    }
I commented out this line to stop that behavior:
PHP:
echo "set $k = $v <br>";
I had another problem which is, when ever I show this form that showed the filtered list, then I try to show the original list I receive an empty list. I tried restfilters from the menu options but didn't work. Logging out and in again worked.

I commented out the last line too and it seems to work again perfectly. It even show the filter in the element and applies it when I add new items.

PHP:
//$input->set('fabrik_sticky_filters', array_keys($qs_arr));
What do you think Rob? should I change that and create a pull request on Github?
 
OK I think I spoke too early. Commenting the last line does show the filter and applies it to new records as I wanted. But the list from the content plugin returns an empty list.
 
Filters set in the {fabrik.....} declaraion are to be treated as prefilters, which is what the 'fabrik_sticky_filter' code is related to, so an element filter set up here should not create a dropdown filter in the list view (in the same way that a list prefilter doesn't create a selection-able filter in the list view)

when ever I show this form that showed the filtered list, then I try to show the original list I receive an empty list.
I'm not 100% sure what you are doing here, could you make a quick video showing the issue?
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top