OnEnter Searchbar With Result Count

FAQ Design & Development (Coming Soon)

Advance Search Bar Filter With Result Count Advance Search Bar Filter With Result Count Advance Search Bar Filter With Result Count

import wixData from 'wix-data';


 

export function Searchbar_change(event) {

    search()

}


 

function search() {

 

       $w("#dataset1").onReady(function () {

            $w("#dataset1").setFilter(wixData.filter()

 

            .contains('title', String($w('#Searchbar').value))

            .or(wixData.filter().contains("designation", String($w('#Searchbar').value))))

        

            .then(count)

            

        })

    }

 

function count() {

    let count = $w("#dataset1").getTotalCount();

    if (count > 0) {

        $w("#countText").text = `${count} items found`;

 

    } else { $w("#countText").text = `No item found`; }

 

    return count;

}

 

$w.onReady(function () {

    $w("#dataset1").onReady(() => {

    let count = $w('#dataset1').getTotalCount();

        if (count > 0) {

            $w('#countText').text = `${count} items found`;

        }

 

    })

});


 

export function Searchbar_keyPress(event) {

     if (event.key === "Enter") {

        search()

    }

}

COPY CODE !