I was wondering if anyone could help me. I am new to code (brand new) and am having a bit of trouble with my drop down menus. Although I’m new to code, I’m loving the possibilities that it opens up for website design and functionality on the Wix platform!
I’ve created a database for a recruitment agency with a list of available jobs and fields (job title, classification, sub-classification, location, etc.)
With help from this fantastic forum I’ve been able to create a working:-
- Search field which filters the job title
- Drop down menu for location
- Drop Down menu for job classification
Unfortunately, My drop down menu shows all the locations listed in the database so there are double ups (see right) and there is no logical structure. As you can see Christchurch appears 3 times… etc.
My question is: How do I create a drop down that shows custom location values (New Zealand’s major regions, and not all the location values in the database column), which then searches the location field of my database?
I also wondered how to link all the search menus, so that each search box filters the results in conjunction with one another? For example Someone could type in ‘Pricing Analyst’, then select ‘Christchurch’ and then ‘Banking and Finance’, and get search results ONLY showing jobs that match all three specific criteria. At the moment the search menus work separately.
I hope this all made sense? Any help would be hugely appreciated! Thanks
Hi,
I recommend checking out this video tutorial . Moreover, you can check this thread for filtering repeater and this thread for filtering table using multiple user inputs.
I am now trying to link all the search menus, so that each search box filters the results in conjunction with one another. I have referred to the links provided by Tal (above) although due to the fact that I’m just starting out with code, I’m having trouble understanding the examples and determining what code is relevant to me and what is not.
Essentially I want to create a job search that works together to refine and filter results from my table. I would like it to filter results such as the example below. Any help would be much appreciated! I’ve spent so much time on this so far!
I have named my elements as follows:-
Search bar = ‘#input1’
Location drop down = ‘#location1’
Classification drop down = ‘#classification’
Table = ‘#table1’
Dataset = ‘#dataset2’
Database = ‘careers’
So far my search bar and drop downs work independently of one another. Can anyone show me where I am going wrong? Many thanks!!!
My code so far is :-
import wixData from ‘wix-data’;
$w.onReady(function () {
//TODO: import wixData from ‘wix-data’;
});
Hi,
You wish to have multiple filtering, meaning that whenever a user changes the drop down, it filters the results accordingly. In your case, you have 2 drop downs and one user input. I recommend using the JS filter function. The example here explains it pretty well. It’s even the same scenario
The first step mentioned there is in order to get all results from the collection.
The second step is to get all user inputs values and filter the data accordingly. The if statements are in order to check if they are not set to the default values (in your case “keywords (optional)”, “Location” and “Classification”).
The third step is basically the onChange of each of your user input fields (in your case the Search bar, Location drop down andClassification drop down).
Please excuse my ignorance with Wix code, I’m still very new!
What is the green value ’ ‘כל המשרות’ in the example?
and ‘כל התחומים’ values? Sorry, I translated and it says ‘all jobs’ although
I’m confused as to what that would be in my case?
These are the default parameters that the other user used. Instead of ‘כל המשרות’, you should insert your default values : " keywords (optional) ", " Location " and " Classification ".
I still cant get it to work, there are no error messages showing when I run the code although I’m still not getting any results and the table remains blank. I was wondering if you were able to help we figure out where I am going wrong?