Hi, I was wondering if someone could help me with my search filters to work properly. They only filter correctly when I hit the “.between” portion of my code before it hits the rest of the setFilter function.
Currently, clicking on search logs this error to the console: TypeError: Cannot read property ‘items’ of undefined.
I have 5 filters and a search button. The fields in my database are properly set and the id’s on the drop-downs are properly set. Here is my code. Any help wold be great!
Search filter Id’s:
StreetName
Beds
iBeds
iBaths
iPriceLow
iPriceHigh
import wixData from ‘wix-data’;
export function iSearch_click(event, $w) {
$w(“#dataset1”).setFilter(wixData.filter()
.contains("streetName", $w('#iStreetName').value)
.ge("beds", $w('#iBeds').value)
.ge("baths", $w('#iBaths').value)
.between("price", parseFloat($w('#iPriceLow').value), parseFloat($w('#iPriceHigh').value))
)
.then((results) => {
console.log("Dataset is now filtered");
$w("#repeater1").data = results.items;
}). **catch** ((err) => {
console.log(err);
});
$w("#repeater1").expand();