My friend and I are trying to filter our dynamic page containing series of 'cards', each one containing a first name, last name, specialization, etc. There's a dropdown menu at the top of the page with a button next to it allowing the user to select a certain specialization from the drop down. How can I filter the dynamic page to only show the cards containing that specialization?
I think wix says you can't filter dynamic pages unless you use code, so here's what we used:
import wixData from 'wix-data'; export function button9_click(event) { //our button was #button9 let value = $w("#dropdown1").value; let filter = wixData.filter(); $w("#dynamicDataset").setFilter( . //name of dataset filter.eq("industrySpecialization") //does this need a second parameter of value? ); }
What are we doing wrong/what can we change?
Hi Somil, russian-dima đ
It's wrong to compare the value of the dropdown menu with 0, the value is a string used to identify the item inside the dropdown menu.
So either use this to check if no option is selected:
if ($w('#dropdown1').value !== undefined)
Or use this method:
if ($w('#dropdown1').selectedIndex !== 0)
Learn more about the value and selectedIndex and properties.
Good luck with this one. I am a Wix Partner and provided the code to request someone review it because it was not functioning. They replied with a few corrections that still didnt work. Now I am stuck and they remind me that they do not support assistance with coding issues. Jeez
Hi, if someone could help me with the same issue.
I have a dynamic page for posting job details and would like to have a dropdown to filter results by location, would be great if some one could help me the code in wix.
This did not work either :( thank you for the response though!
Thank you for the response but if anyone has anything a little more specific I'd appreciate it
Hello Somil Vinod,
here you can see an example, how to work with filter...
https://russian-dima.wixsite.com/meinewebsite/blank-3