top of page
Top Of Page

Working Example

List to filter

Repeater: #repeater1

Code Examples

Background

Input: #filterText

Button: #filterButton

Filter
Reset

Button: #resetButton

Text: #itemCount

Number of List items:

2

Working Example

Page Code

// For full API documentation, including code examples, visit http://wix.to/94BuAAs

import wixData from 'wix-data';

 

$w.onReady(function () {

    //TODO: write your page related code here...

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

        updateCounterElement();

    });

    

});

 

export function filterButton_click(event) {

    //

    let filterText = $w('#filterText').value;

    if (filterText === '') {

        filterText = 'ground';

        $w('#filterText').value = filterText;

    }

    $w('#dataset1').setFilter(wixData.filter().contains('hoverTitle', filterText))

     .then(() => {

            updateCounterElement();

        });

}

 

function updateCounterElement() {

    $w('#itemCount').text = $w('#dataset1').getTotalCount().toString();

}

 

export function resetButton_click(event) {

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

     .then(() => {

            $w('#filterText').value = undefined;

            $w('#filterText').resetValidityIndication();

            updateCounterElement();

        });

}

Page Code

© 2018 by Steve Cropper. Proudly created with Wix.com

  • Google+ - White Circle
  • Facebook - White Circle
  • Twitter - White Circle
bottom of page