How to execute 2 filters on an onClick() event?

I have this code at the moment:

import wixData from 'wix-data';

$w.onReady(function () {
    $w("#searchButton").onClick(()=>{
        $w("#propertiesDataset").setFilter(wixData.filter()
            .eq("status", $w("#dropdown").value)
            .eq("address", $w("#search").value));
    });

I am trying to make it so that users can use a radio button, and a search bar to filter for items in the database, but when I take out the second .eq line it works.

Where am I going wrong?

Hi !!!
Try this →

$w . onReady ( function () {
$w ( “#searchButton” ). onClick ((event) => {
$w ( “#propertiesDataset” ). setFilter ( wixData . filter ()
. eq ( “status” , $w ( “#dropdown” ). value )

        . eq ( "address" ,  $w ( "#search" ).value); 

)
});
});

Hey,
Thanks for the response. This doesnt seem to be working as it is saying

“Parsing error: Unexpected token wixData” on the wixData . filter ()

@lukevb yeah !!!
Place the below code on the above of all your code

import wixData from ‘wix-data’;

@ajithkrr This is already there, so all my code is as follows:

import wixData from 'wix-data';

$w.onReady(function () {
    $w("#searchButton").onClick(()=>{
        $w("#propertiesDataset").setFilter(wixData.filter()
            .eq("status", $w("#dropdown").value)
        wixData.filter()
            .eq("address", $w("#search").value);

});
    })


Try this →

import wixData from ‘wix-data’ ;
$w . onReady ( function () {
$w ( “#searchButton” ). onClick ((event) => {
$w (“# propertiesDataset” ). setFilter ( wixData . filter ()
.eq( “status” , $w ( “#dropdown” ). value )
.eq( “address” , $w ( “#search” ). value )
)

});
});

Weird, nothing comes up. I think thats the same code as OP?

Maybe there’s no match.

@jonatandor35 If i take

.eq("address", $w("#search").value)

Out of the code, it works fine with the radio buttons, which is the #dropdown, but as soon as I add in the address search in it no longer works.

@lukevb Try using. contains

.contains ( “address” , $w ( " #search " ). value )

@ajithkrr So I have made sure there is an item which will filter when filtering using this code.

Just nothing comes up.

My code is now:

import wixData from ‘wix-data’ ;

$w.onReady( function () {
$w( “#searchButton” ).onClick(()=>{

  $w( "#propertiesDataset" ).setFilter( wixData.filter() 
    .eq( "status" , $w( "#dropdown" ).value) 
    .contains( "address" , $w( "#search" ).value)) 

  }); 

});

EDIT:

It works… But only with certain searches… Like searching SL8 brings up results, but HP10 does not…

Check your database items and here also →
https://www.wix.com/corvid/reference/wix-data/query