Help !! -

Hi, I really need your help on a very important matter to me.
Can someone help me out?
I need to filter 3 different objects: Price, Location & Size - But When I use the code it’s filtering only the location.

Thanks

This is the code:

import wixData from ‘wix-data’;

export function search_click(event, $w) {
console.log($w(‘#location’).value);
$w(‘#dataset1’)
.setFilter(
wixData.filter()
.eq(“location”, $w(‘#location’).value));
console.log($w(‘#dealtyp’).value);
$w(‘#dataset1’)
.setFilter(
wixData.filter()
.eq(“dealtype”, $w(‘#dealtyp’).value));
console.log($w(‘#price’).value);
$w(‘#dataset1’)
.setFilter(
wixData.filter()
.eq(“price”, $w(‘#price’).value));

//console.log(“1”);
$w(‘#dataset1’).refresh();
}

According to http://www.wix.com/code/reference/wix-data.html, “[y]ou can refine the query by chaining WixDataQuery functions on to the query.”

In response, would replacing your code with the following work for you:

import wixData from ‘wix-data’;

export function search_click(event, $w) {
console.log($w(’ #location ‘).value);
$w(’ #dataset1 ‘).setFilter(
wixData.filter()
.eq(“location”, $w(’ #location ‘).value))
.eq(“dealtype”, $w(’ #dealtyp ‘).value))
.eq(“price”, $w(’ #price ‘).value)
);
$w(’ #dataset1 ').refresh();
}

?

1 Like

Thank you !!!

You’re welcome!