top of page

Dropdown Filters in Wix



Velo Code:


import wixData from 'wix-data';


export function searchButton_click(event) {
    search();
}

function search() {
	wixData.query("Properties")
        .contains("propertieType", String($w("#dropdown1").value))
        .and(wixData.query("Properties").contains("listingType", String($w("#dropdown2").value)))

        .find()
        .then(results => {
            $w("#propertiesRepeater").data = results.items;
            $w('#searchButton').hide();
            $w('#resetButton').show();
            $w('#resetButton').enable();
        });
}

export function resetButton_click(event) {
    $w('#propertiesDataset').setFilter(wixData.filter());
    $w('#dropdown1').value = undefined;
    $w('#dropdown2').value = undefined;
    $w('#resetButton').hide();
    $w('#searchButton').show();
}

Enjoy!

bottom of page