top of page

Filter Repeaters Without Buttons



Filter with Text Input:


import wixData from 'wix-data';

$w.onReady(function () {
    $w('#searchInput').onInput(() => {
        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;
        });
}

Filter with Dropdown:


import wixData from 'wix-data';

$w.onReady(function () {
    $w('#dropdown1').onChange(() => {
        search();
    })    
});

function search() {

    wixData.query("Properties")
        .contains("title", $w('#dropdown1').value)
        .or(wixData.query("Properties").contains("agentName", $w('#dropdown1').value))

        .find()
        .then(results => {
            $w('#propertiesRepeater').data = results.items;
        });
}

Enjoy!


Comments


bottom of page