Can someone give me a code to make a dropdown filter to connect to my database. I’ve made a search bar already where they can search by name but i want to make a filter by state and city.
I tried one but it wasn’t working. I’m 17 and have never coded before in my life .
Hello there!
I think it will be easy for you to create a dropdown filter. I am 14 and I am still new to corvid too, but I am improving like a rocket! Here is the code anyway.
import wixData from 'wix-data';
export function dropdown1_change(event) { //make shore you have added the on_change event to the dropdown in the properties panel.
let searchValue = $w("#dropdown1").value;//#dropdown1 is your dropdown id
$w("#dataset1").setFilter(wixData.filter().contains('quality', searchValue)); //#dataset1 is your dataset on the page. 'quality'is the bit in your database you want to filter
}
You say you already have a search bar right? You can actually create a search bar using this example. I think it is easier to create your search bar the same way as your drop down if you want to filter your search bar using your dropdown or the other way round.
~Hope this helps!~
Arthur😅
Do what? Create a drop down? Create a search bar? Or make both the search bar and dropdown filter each other?
Hello together,
additional to Arthur’s suggestions you can take a look at this little example here…
https://russian-dima.wixsite.com/meinewebsite/blank-3
Which will show you the working filter-process.
Hi, I am new to wix. I am trying to find a code that will help me with my search bar for my real estate company. The challenge is my page is a dynamic page and i need to filter and use the find button to return result to a repeater. Can someone help i have been on this for weeks and going nowhere.
Hi Temile,
This is an old post and will now be closed. Please create a new post following our posting guidelines here . Add a descriptive title of what you’re trying to do, and include all of the code you’re written.
You may want to look at some of our Velo Examples . This example for searching a database should help you get started.