@tony-brunsman Cool you are the man of the situation then! Here is the code for the filtering:
//// FILTERING
let originalPropertiesInfo = ;
let filteredResults = ;
$w.onReady( function () {
wixData.query(“Annonces”)
.eq(“approuve”, true )
.eq(“categorie”, “À VENDRE”)
.descending(“_updatedDate”)
.find()
.then((results) => {
originalPropertiesInfo = results.items;
$w(“#repeater1”).data = originalPropertiesInfo;
})
. catch ((err) => {
let errorMsg = err;
});
})
function filterResults() {
filteredResults = ;
const type = $w(‘#dropdown1’).value;
const dist = $w(‘#district’).value;
const city = $w(‘#city’).value;
const prixmin = parseInt($w(‘#input15’).value,10);
const prixmax = parseInt($w(‘#input16’).value,10);
const surfmin = parseInt($w(‘#input17’).value,10);
const surfmax = parseInt($w(‘#input20’).value,10);
const chammin = parseInt($w(‘#input21’).value,10);
const chammax = parseInt($w(‘#input22’).value,10);
const park = $w(‘#dropdown13’).value;
const salle = $w(‘#dropdown14’).value;
filteredResults = originalPropertiesInfo.slice();
if (type && type !== ‘Type de bien’) {filteredResults = filteredResults.filter(item => item.typeDeBien === type);}
if (dist && dist !== ‘District’) {filteredResults = filteredResults.filter(item => item.district === dist);}
if (city && city !== ‘Ville/Village’) {filteredResults = filteredResults.filter(item => item.villeVillage === city);}
if (prixmin && prixmin !== ‘Prix min’) {filteredResults = filteredResults.filter(item => item.prixrs >= prixmin );}
if (prixmax && prixmax !== ‘Prix max’) {filteredResults = filteredResults.filter(item => item.prix <= prixmax);}
if (surfmin && surfmin !== ‘Surface min’) {filteredResults = filteredResults.filter(item => item.metrecarre >= surfmin);}
if (surfmax && surfmax !== ‘Surface max’) {filteredResults = filteredResults.filter(item => item.metrecarre <= surfmax );}
if (chammin && chammin !== ‘Chambre min’) {filteredResults = filteredResults.filter(item => item.chambres >= chammin);}
if (chammax && chammax !== ‘Chambre max’) {filteredResults = filteredResults.filter(item => item.chambres <= chammax);}
// + de critere
if (park && park !== ‘Garage/Parking’) {filteredResults = filteredResults.filter(item => item.garageParking >= park);}
if (salle && salle !== ‘Salle de bains’) {filteredResults = filteredResults.filter(item => item.sallesDeBains >= salle);}
if ($w(“#checkbox87”).checked=== true ) {filteredResults = filteredResults.filter(item => item.meuble === true );}
if ($w(“#checkbox88”).checked=== true ) {filteredResults = filteredResults.filter(item => item.neuf === true );}
if ($w(“#checkbox90”).checked=== true ) {filteredResults = filteredResults.filter(item => item.climatise === true );}
if ($w(“#checkbox91”).checked=== true ) {filteredResults = filteredResults.filter(item => item.jardin === true );}
if ($w(“#checkbox92”).checked=== true ) {filteredResults = filteredResults.filter(item => item.piscine === true );}
if (filteredResults.length === 0){$w(‘#repeater1’).collapse(); $w(‘#box9’).show(); $w(‘#box102’).hide(); $w(‘#pagination1’).collapse();}
if (filteredResults.length >= 1) {$w(‘#repeater1’).expand(); $w(‘#box9’).hide(); $w(‘#box102’).show(); $w(‘#pagination1’).expand();}
$w("#text119").text = filteredResults.length.toString() + ' ' + 'annonces';
dropdown1_change();
city_change();
district_change();
input15_change();
input16_change();
input17_change();
input20_change();
input21_change_1();
input22_change_1();
dropdown13_change();
dropdown14_change();
checkbox87_change();
checkbox88_change();
checkbox90_change();
checkbox91_change();
checkbox92_change();
}
// Apply filtering to repearter1
export function dropdown1_change(event) {
$w(‘#button3’).onClick(() => {
$w(‘#repeater1’).data = filteredResults;
$w(‘#repeater1’).forEachItem(($w, itemData) => {$w(‘#input2’).value = itemData.typeDeBien;})
});
}
export function district_change(event) {
$w(‘#button3’).onClick(() => {
$w(‘#repeater1’).data = filteredResults;
$w(‘#repeater1’).forEachItem(($w, itemData) => {$w(‘#input41’).value = itemData.district;})
});
}
export function city_change(event) {
$w(‘#button3’).onClick(() => { $w(‘#repeater1’).data = filteredResults;
$w(‘#repeater1’).forEachItem(($w, itemData) => {$w(‘#input42’).value = itemData.villeVillage;})});
}
export function input15_change(event) {$w(‘#button3’).onClick(() => {$w(‘#repeater1’).data = filteredResults;
$w(‘#repeater1’).forEachItem(($w, itemData) => {$w(‘#input18’).value = itemData.prixrs;})});}
export function input16_change(event) {$w(‘#button3’).onClick(() => {$w(‘#repeater1’).data = filteredResults;
$w(‘#repeater1’).forEachItem(($w, itemData) => {$w(‘#input18’).value = itemData.prixrs;})});}
export function input17_change(event) {$w(‘#button3’).onClick(() => {$w(‘#repeater1’).data = filteredResults;
$w(‘#repeater1’).forEachItem(($w, itemData) => {$w(‘#input19’).value = itemData.metrecarre;})});}
export function input20_change(event) {$w(‘#button3’).onClick(() => {$w(‘#repeater1’).data = filteredResults;
$w(‘#repeater1’).forEachItem(($w, itemData) => {$w(‘#input19’).value = itemData.metrecarre;})});}
export function input21_change_1(event) {$w(‘#button3’).onClick(() => {$w(‘#repeater1’).data = filteredResults;
$w(‘#repeater1’).forEachItem(($w, itemData) => {$w(‘#input14’).value = itemData.chambres;})});}
export function input22_change_1(event) {$w(‘#button3’).onClick(() => {$w(‘#repeater1’).data = filteredResults;
$w(‘#repeater1’).forEachItem(($w, itemData) => {$w(‘#input14’).value = itemData.chambres;})});}
export function dropdown13_change(event) {$w(‘#button3’).onClick(() => { $w(‘#repeater1’).data = filteredResults;
$w(‘#repeater1’).forEachItem(($w, itemData) => {$w(‘#input23’).value = itemData.garageParking;})}); }
export function dropdown14_change(event) {$w(‘#button3’).onClick(() => { $w(‘#repeater1’).data = filteredResults;
$w(‘#repeater1’).forEachItem(($w, itemData) => {$w(‘#input24’).value = itemData.sallesDeBains;})}); }
export function checkbox87_change(event) {$w(‘#button3’).onClick(() => { $w(‘#repeater1’).data = filteredResults;
$w(‘#repeater1’).forEachItem(($w, itemData) => {$w(‘#switch2’).value === itemData.meuble;})}); }
export function checkbox88_change(event) {$w(‘#button3’).onClick(() => { $w(‘#repeater1’).data = filteredResults;
$w(‘#repeater1’).forEachItem(($w, itemData) => {$w(‘#switch8’).value === itemData.neuf;})}); }
export function checkbox90_change(event) {$w(‘#button3’).onClick(() => { $w(‘#repeater1’).data = filteredResults;
$w(‘#repeater1’).forEachItem(($w, itemData) => {$w(‘#switch10’).value === itemData.climatise;})}); }
export function checkbox91_change(event) {$w(‘#button3’).onClick(() => { $w(‘#repeater1’).data = filteredResults;
$w(‘#repeater1’).forEachItem(($w, itemData) => {$w(‘#switch11’).value === itemData.jardin;})}); }
export function checkbox92_change(event) {$w(‘#button3’).onClick(() => { $w(‘#repeater1’).data = filteredResults;
$w(‘#repeater1’).forEachItem(($w, itemData) => {$w(‘#switch12’).value === itemData.piscine;})}); }
// Search button
export function button3_click(event, $w) {
filterResults();
}