The code works well until i add the code of price. Then the others stop working and only the price code works.
The issue is that code finds for properties, but if “min price” and “max price” are not chosen, then it doesn’t execute.
import wixData from 'wix-data';
export function button1_click(event, $w) {
wixData.query("Properties")
.ascending("price")
.between("price", Number($w("#dropdown7").value), Number($w("#dropdown8").value))
.contains("propertieType", String($w("#dropdown4").value))
.contains("status", String($w("#dropdown14").value))
.contains("state", String($w("#dropdown12").value))
.contains("location", String($w("#dropdown5").value))
.contains("bedrooms", String($w("#dropdown9").value))
.contains("bathrooms", String($w("#dropdown13").value))
.find()
.then((results) => {
$w("#repeater10").data = results.items;
})
.catch((err) => {
console.log(err);
});
$w("#repeater10").expand();
}
export function repeater10_itemReady($item, itemData, index) {
let currentPrice = itemData.price;
let newPrice = "€" + formatNumber_AsDollar(currentPrice);
$item("#textprice").text = newPrice;
}
function formatNumber_AsDollar (x) {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ".");
}
export function resetButton_click(event) {
$w('#dataset1').setFilter(wixData.filter())
$w("#pagination1").show();
$w('#dropdown4').value = undefined;
$w('#dropdown14').value = undefined;
$w('#dropdown12').value = undefined;
$w('#dropdown5').value = undefined;
$w('#dropdown7').value = undefined;
$w('#dropdown9').value = undefined;
$w('#dropdown13').value = undefined;
$w('#dropdown8').value = undefined;
}