I like to unset my search filter that is saved in the user state.
I have a search input with id filter_search
This is the code to save the filter.
$context = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); $this->setState('filter.search', $context); Now In another function I would like to unset this filter_search state.
How Do I do this?
I already tried this:
$session = Factory::getSession(); $session->clear('.filter.search', 'filter_search'); And
$this->setState('filter.search', ""); But my input field stays filled.
This is my filter_customers.xml
<fields name="filter"> <field name="search" type="text" hint="COM_MYDESTINY_SEARCH_FILTER_SUBMIT" label="COM_USERS_FILTER_SEARCH_DESC" class="js-stools-search-string uk-search-input"/> </fields>