Hi there,
I need some help and I’m not very good at coding. Please show a full script code with simple explanation on how to do this? It will be great with samples of coding and/or video for me to test and understand. Thanks
Hi LostSoul,
Check out this thread .
Feel free to paste your code below.
Roi
Hi LostSoul,
Any success? I am struggling with the same questions also for a property dataset.
Here is my code so far, trying to make this up as I go along and find more info in the forum.
I have been able to create a search based on multiple dropdowns using the following code:
import wixData from ‘wix-data’;
$w.onReady(function () {
$w(“#button2”).onClick(() => {
$w(“#dataset1”).setFilter(wixData.filter()
.eq(“size”, $w(“#dropdown1”).value)
.eq(“location”, $w(“#dropdown2”).value));
});
});
For my trial is used a simple test database with just 2 sizes (large and small) and 2 locations (A and B)
Now the issues with the code above:
- The values of the dropdown are not linked to the database as this shows duplicates. Meaning if there are 5 large properties in the database, the dropdown showed the large value 5 times. So I manually set the size options to large and small.
- If you do not choose an option the placeholder text is used in the filtering process, which will give no results.
- As the dropdown options are not linked to each other it is possible to select a non-existent combination. For example if there are no small properties in location B in the database I like to dropdown2 to only show A if small is selected at dropdown1. Alternative for now is to at least have a text showing up that this combination does not exist
- Reset button. Not figured out how to build that one yet.
I know there is a video on how to create a filter and search, I tried to figure it out, but it was to complex in one go to fully comprehend it. So hopefully by building on above step by step I can get this working and you too. Perhaps with the help of some other expert. I will at least provide updated code if I am one step further in the process.
I know that it has been a while,if you found a solution than and you could share it ,it would be great