Dataset filters - user input text box interferring with dropdown

Hi team,
I need help :).
Page = https://www.fruitfool.co.nz/fruit-tree-selector-tool
What I’m trying to acheive is that when the text field is entered, and then button2 is clicked it will ‘Clear Search’ (which works) but after this the dropdown fields won’t filter (which they work upon first page load). I’ve tried using wix.Location to reset the whole page but that doesn’t seem to be working/happening as I expect. Basic need is for users to be able to filter the dataset, and clear filters, repetitively.

Code:
import wixData from ‘wix-data’ ;
export function input1_keyPress ( event ) {
filter ( $w ( ‘#input1’ ). value )
};
function filter ( title )
{ $w ( ‘#dataset1’ ). setFilter ( wixData . filter (). contains ( ‘notes’ , title ),)}
import wixLocation from ‘wix-location’ ;
export function button2_click ( event ) {
filter ( $w ( “#input1” ). value = “” );
wixLocation . to ( “https://www.fruitfool.co.nz/fruit-tree-selector-tool” );

}

I’ve worked out a workaround but it’s a bit clunky - will leave it here for anyone for future. Also, if you come up with a better solution or can see what I’m doing wrong would still appreciate some feedback.

New code:
import wixData from ‘wix-data’ ;

export function input1_keyPress ( event ) {
filter ( $w ( ‘#input1’ ). value )
}
function filter ( title )
{ $w ( ‘#dataset1’ ). setFilter ( wixData . filter (). contains ( ‘notes’ , title ),)}

And what I’ve done is got a button (it’s called Clear Search) but really it’s function is to link to the page that the user is already on. So they end up refreshing the whole page which clears the search and restarts the code.

To clear the search, you should add an onClick() event handler to the Clear Search button, and in that onClick() function, clear the filter like this:

$w('#dataset1').setFilter(wixData.filter()); // clear with "empty" filter

You can also clear the search field in the same onClick() while you’re at it.

$w('#input1').value = '';

Just to add to the answer above - I’ve now got the link going to a dead page which then 301 redirects back to the selector page which actually makes the page refresh. All other efforts refreshed the page but not entirely so the search was not cleared.