top of page

Search & Dropdown Filter in Wix

Updated: Jun 12



Velo Code:


import wixData from 'wix-data';
$w('#resetButton').hide();


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

function search() {

    wixData.query("Properties")
        .contains("status", String($w('#dropdown1').value))
        .and(wixData.query("Properties").contains("propertieType", String($w('#dropdown2').value)))
        .and(wixData.query("Properties").contains("title", $w('#input1').value)
        .or(wixData.query("Properties").contains("agentName", $w('#input1').value)))

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

}

export function resetButton_click(event) {

    $w('#propertiesDataset').setFilter(wixData.filter());
    $w('#dropdown1').value = undefined;
    $w('#dropdown2').value = undefined;
    $w('#input1').value = undefined;
    $w('#searchButton').show();
    $w('#searchButton').enable();
    $w('#resetButton').hide();
}

Enjoy!

Comments


bottom of page