[Solved] Checkbox filtering code problems

I actually solved the Reset Button also, if it may help anyone here’s the full code with the reset button:

import wixData from 'wix-data';

$w.onReady(function () {
    
});

//Restaurant filter
 export function filterPlaces(){
 let city = [];
 let area = [];
 let vibe = [];
 let sunshine = [];
 
 // Get the indexes of all the checkboxes checked in that group
 let cityOptions = $w("#cityGroup").selectedIndices
 let areaOptions = $w('#areaGroup').selectedIndices
 let vibeOptions = $w('#vibeGroup').selectedIndices
 let sunshineOptions = $w('#sunshineGroup').selectedIndices
 let filter = wixData.filter();

 // Next, loop through the checked items and add each field to the array and apply filter
 if (cityOptions.length > 0){
 for (var i = 0; i < cityOptions.length; i++) {
        city.push($w('#cityGroup').options[cityOptions[i]].value);
        }
    }
 if (city.length > 0) {
        filter = filter.hasSome("city", city); //The "city" is a reference to the FiledKey in the database
    }

 if (areaOptions.length > 0){
 for (var i2 = 0; i2 < areaOptions.length; i2++) {
            area.push($w('#areaGroup').options[areaOptions[i2]].value);
        }
    }
 if (area.length > 0) {
        filter = filter.hasSome("area", area);
    }

 if (vibeOptions.length > 0){
 for (var i3 = 0; i3 < vibeOptions.length; i3++) {
            vibe.push($w('#vibeGroup').options[vibeOptions[i3]].value);
        }
    }
 if (vibe.length > 0) {
        filter = filter.hasSome("bestfor", vibe);
    }

 if (sunshineOptions.length > 0){
 for (var i4 = 0; i4 < sunshineOptions.length; i4++) {
            sunshine.push($w('#sunshineGroup').options[sunshineOptions[i4]].value);
        }
    }
 if (sunshine.length > 0) {
        filter = filter.hasSome("sunshine", sunshine);
    }
 
    $w("#dataset1").setFilter(filter)
        .then(() => {
            console.log("count after", $w("#dataset1").getTotalCount()); 
        })

        .catch((err) => {
            console.log(err);
        });
        
$w('#resetButton').onClick(function () {
    $w('#cityGroup').value = undefined
    $w('#areaGroup').value = undefined
    $w('#vibeGroup').value = undefined
    $w('#sunshineGroup').value = undefined

    $w('#dataset1').setFilter(wixData.filter())
});
    }

 // Filter each time you click a check box in a group
 export function cityGroup_change (event) {
        filterPlaces();
    }

 export function areaGroup_change(event) {
        filterPlaces();
    }

 export function vibeGroup_change(event) {
        filterPlaces();
    }

 export function sunshineGroup_change_1(event) {
        filterPlaces();
    }
1 Like