Hi everyone, I need your expertise. I tried to search for answers in this community but unfortunately couldn’t get the results I’m looking for. I need to display “no results found” when each function is clicked.
Here are my codes;
import wixData from ‘wix-data’ ;
$w.onReady( function () {
});
let lastFilter1;
let lastFilter2;
let lastFilter3;
let lastFilter4;
function filter(filter1, filter2, filter3, filter4) {
if (lastFilter1 !== filter1 || lastFilter2 !== filter2 || lastFilter3 !== filter3 || lastFilter4 !==filter4) {
let newFilter = wixData.filter();
if (filter1)
newFilter = newFilter.contains( ‘status’ , filter1);
if (filter2)
newFilter = newFilter.contains( ‘propertieType’ , filter2);
if (filter3)
newFilter = newFilter.contains( ‘bedrooms’ , filter3);
if (filter4)
newFilter = newFilter.contains( ‘address’ , filter4);
$w( “#propertiesDataset” ).setFilter(newFilter);
lastFilter1 = filter1;
lastFilter2 = filter2;
lastFilter3 = filter3;
lastFilter4 = filter4;
}
}
export function statusDropdown_change(event, $w) {
filter($w( “#statusDropdown” ).value, lastFilter2, lastFilter3, lastFilter4);
}
export function proptypeDropdown_change(event, $w) {
filter(lastFilter1, $w( “#proptypeDropdown” ).value, lastFilter3, lastFilter4);
}
export function bedroomDropdown_change(event, $w) {
filter(lastFilter1, lastFilter2, $w( “#bedroomDropdown” ).value, lastFilter4);
}
export function locationDropdown_change(event, $w) {
filter(lastFilter1, lastFilter2, lastFilter3, $w( “#locationDropdown” ).value);
}