Error on setFilter

Hey, thats my code:

import wixData from ‘wix-data’ ;

$w . onReady ( function () {
});

export function filterButton_onClick ( event ) {
$w ( “#dataset1” ). setFilter ( wixData . filter ()
. contains ( “stichworte” , $w ( “#input1” ). value ));
}

Error message, when running filterButton_onClick by button click:

TypeError: $w(…).setFilter is not a function


Any idea :frowning:
Thanks a lot!

Try putting the .setFilter inside the onReady function of the dataset.

$w(“#dataset1”).onReady(() => {
$w ( “#dataset1” ). setFilter ( wixData . filter ()
. contains ( “stichworte” , $w ( “#input1” ). value ));
})

I tried that, (assuming you wanted that snippet still within the filterButton_onClick function.
Same error :confused:

Ok for some reason, simply reloading the page, fixed it. Thanks anyways!

@noahschlueterbln
try this one

$w.onReady(function(){
$w('#filterButton').onClick(()=> {
    $w("#dataset1").onReady(() => { 		             $w("#dataset1").setFilter(wixData.filter()
	.contains("stichworte",$w("#input1").value)); })
})
});

Good to hear!