Question:
I have created a repeater connected to a CMS dataset. The repeater is filtered with a dropdown list connected to the same dataset. Right now before selecting an option from the dropdown list the repeater by default shows ALL the items in the dataset. The question is, how do I show NO items or essentially hide the repeater when there is no option selected from the dropdown list?
Please help!
Product:
Wix Studio
Set the repeater to hidden by default
Then re-check when the dataset reloads
Something like this
$w('#dataset').onReady(() => {
if ($w('#dropdown').value) $w('#repeater').show()
else $w('#repeater').hide()
})
Hi thank you for your answer!
I tried it but got this error:
Any other suggestions?
Sorry, it’s onReady
, not onItemReady
Ok now no error in the code, but still not working. The repeater is hidden but when I select an option from the dropdown list it does not reappear.
Is the dropdown connected to filter the dataset? When not hiding the repeater, the selection of the dropdown works?
Yes so I set the repeater default to hidden and the selection of the dropdown is working, but I’m still where I started in that when the page loads and there is no selection in the dropdown it is showing me all of the items in the repeater instead of none of them.
(I also had to change the word values for options in your code for it to work - fyi - not sure how critical that is)
so this is how it looks now:
Dropdown onChange show repeater.
I thought of suggesting that, but since the repeater may take a bit longer to load the items from the refreshing dataset, it may look clunky