Hi everyone !
So, here is my question : I would like to make a “two step” dropdown, where the first step show categories and the second step shows all interests associated to this specific category.
Here is the code I did so far, yet it’s not working because the .click() function is not recognized apparently…
// #dataset1 is connected to the dropdow list
let interestCounter = 0
$w('#dropdown1').onChange(() => {
dropdownChanged()
function dropdownChanged() {
if (interestCounter === 0) {
// on the first time that we click the dropdown, we filter the list of interests by the selected category value
$w('#dataset1').setFilter(wixData.filter().eq("category", $w('#dropdown1').value)).then(() => {
$w('#dropdown1').click() // the part that is not working
})
interestCounter++
} else {
// the dropdown is programmatically clicked, and we filter the final results by the selected interest value
$w('#resultDataset').setFilter(wixData.filter().eq("interest", $w('#dropdown1').value)).then(() => {
interestCounter = 0
})
}
}
Thank you !