top of page

Search Filter in Wix



Velo Code:


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


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

function search() {
    wixData.query("Properties")
        .contains("title", $w('#searchInput').value)
        .or(wixData.query("Properties").contains("agentName", $w('#searchInput').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('#searchInput').value = undefined;
    $w('#searchButton').show();
    $w('#searchButton').enable();
    $w('#resetButton').hide();
}

Enjoy!

Kommentare


bottom of page