Dropdown

Hello,

In the data base I have colomuns with value “yes” or “blank”
I want to use a dropdown list and filter with values : "those title colomuns "
and display on a repeater the results.
I used this but it’s doesnt work.
Thanks for your help.

import wixData from ‘wix-data’;

$w.onReady( function () {
//TODO: import wixData from ‘wix-data’;
});

export function categorie_change() {
wixData.query(‘Lieux’)
.eq(‘#categorie.value’,‘yes’)
.ascending(“lieu”)
.find()
.then(res => {
$w(‘#repeater1’).data = res.items;
});

}

Hi John,

You need to implement an onItemReady() function for the Repeater.

Good luck,

Yisrael

Hello Yisrael,
Thank you so much for your clue.
I worked all day my repeater is workin and I can filter with multiples dropdown.
but now I have 2 problems :

1) How to clear Dropdown to original position ?

export function button1_click(event, $w) {
 //Add your code for this event here: 
    $w("#xxxx").selectedIndex = 0;
    $w("#yyyy").selectedIndex = 0;
    $w("#zzzz").selectedIndex = 0;
    $w("#aaaa").selectedIndex = 0;
 // add code for other dropdown selection menus
}

This code puts the dropdown back on the first value (of the sorted list without duplicates) and not on the original title of dropdown.

  1. My second problem is this case :
    Let imagine we have :
    filter 1 with values : 1,2 or 3
    filter 2 : values A, B, C, D
    If I chose filter 1 value 1,
    For filter 2 : I only need to see value C and D concerned by my first choice of filter 1,

In case I dont find a solution users will finish with blank pages with no results according to a choice of two values on dropdowns that dont match.

Thank you in advance for your help.