Filter issues

Hi guys, I am having an issue with the filter settings on my dataset.

On my Queensland page it displays the correct holiday properties (Properties datset with a filter for location contains ‘Queensland’) which works great on load. However as soon as I do any filtering using my dropdowns, it includes properties from other locations?

Do I somehow have to add this filter to the code below as well?

CODE:

import wixData from ‘wix-data’;
let originalPropertiesInfo = ;
let filteredResults = ;
$w.onReady(function () {
//Query to get the information from the database
wixData.query(“Properties”)
.find()
.then((results) => {
originalPropertiesInfo = results.items;
$w(#repeater2).data = originalPropertiesInfo;
})
.catch((err) => {
let errorMsg = err;
});
//Set the information to the repeater
$w(#repeater2).onItemReady(($w, itemData) => {
//parseInt($w(‘#text53’).text = itemData.guests);
$w(‘#text53’).text = itemData.guests;
$w(#text52).text = itemData.title;
$w(‘#image2’).src = itemData.images;
$w(‘#text50’).text = itemData.bedrooms;
$w(‘#text51’).text = itemData.bathrooms;
});
});

function filterResults() {
filteredResults = ;
const type = $w(‘#Type’).value;
const guests = parseInt($w(‘#Guests’).value,10);
const rooms = parseInt($w(‘#Rooms’).value,10);
const bathrooms = parseInt($w(‘#Bathrooms’).value,10);

filteredResults = originalPropertiesInfo.slice(); 

if (type && !(type === 'Choose type of accommodation' || type === 'All')) { 
	filteredResults = filteredResults.filter(item => item.type === type); 
}  

if (guests && guests !== 'Choose number of guests') { 
	filteredResults = filteredResults.filter(item => item.guests >= guests); 
} 

if (rooms && rooms !== 'Choose number of beds') { 
	filteredResults = filteredResults.filter(item => item.bedrooms >= rooms); 
} 

if (bathrooms && bathrooms !== 'Choose number of bathrooms') { 
	filteredResults = filteredResults.filter(item => item.bathrooms >= bathrooms); 
} 
if (filteredResults.length === 0){$w('#box3').show();} 
else $w('#box3').hide(); 


Guests_change(); 

}

export function Guests_change(event) {
//filtering the results
//setting the data
$w(‘#repeater2’).data = filteredResults;
//setting the repeater elements
$w(‘#repeater2’).forEachItem(($w, itemData) => {

	$w('#text53').text = itemData.guests; 
	$w(`#text52`).text = itemData.title; 
	$w('#image2').src = itemData.images; 
	$w('#text50').text = itemData.bedrooms; 
	$w('#text51').text = itemData.bathrooms; 
}); 

}

export function refine_onClick(event, $w) {
filterResults();
$w(“#button6”).show();
}

export function button6_onClick(event, $w) {
$w(“#Type”).selectedIndex = 0;
$w(“#Guests”).selectedIndex = 0;
$w(“#Rooms”).selectedIndex = 0;
$w(“#Bathrooms”).selectedIndex = 0;
$w(“#button6”).hide();
filterResults();
}

I know it has been a while, but did you ever get this issue resolved? I’m having a similar issue where job titles and cause of death aren’t filtering off a dataset.

Hope things turned out well for you!
Jenny