Dear all,
I got a property search working smoothly, with dropdowns, and connected to a database collection, that filter results and display it through a reapeater. Now i'd like to add "checkbox(es)" to get "more filter" like : "Swimming pool" and "balcony" and "garden"...
Here is the code i use for my dropdown search :
import {wixData} from 'wix-data'; export function button1_click(event, $w) { $w("#dataset1").setFilter(wixData.filter() .contains("nomDuBien", $w('#dropdown5') .value) .ge("pieces", $w('#dropdown2') .value) .contains("jardin", $w('#radioGroup1').value) .between("surface",parseFloat($w('#dropdown6').value), parseFloat($w('#dropdown7').value)) .between("price",parseFloat($w('#dropdown3').value), parseFloat($w('#dropdown4').value))) .then((results) => { if ($w("#dataset1").getTotalCount() > 0) { $w("#repeater1").expand(); $w("#text80").text = "Voici vos résultats"; $w("#repeater1").data = results.items; } else { $w("#repeater1").collapse(); $w("#text80").text = "Désolé il n'y a pas de résultats, essayez d'autres critères"; } }).catch((err) => { console.log(err); }); }
A basic... now, before results, i need to filter again with checkboxes checked or not. i already crated 3 more filter in my database collection : swimming pool / balcony / garden / that i set up on "boolean" with the check or not.
How should be my code after : .between("price",parseFloat($w('#dropdown3').value), parseFloat($w('#dropdown4').value))) to include my checkbox search ?? Thanks in advance to all of you.
Thx Yisrael,
But the exemple you gave to me, is not the same thing i'm trying to do, i want to keep my dropdowns and ADD more checkboxes in 1 search. Maybe my title (Adding checkboxes to a "dropdown search") isn't right.... so when i click on button, that runs the script that i have already, including my dropboxes, to get results. could you give me an example of code to add ?
export function button1_click(event, $w) { $w("#dataset1").setFilter(wixData.filter()
.contains("nomDuBien", $w('#dropdown5') .value)
.ge("pieces", $w('#dropdown2') .value)
.contains("jardin", $w('#radioGroup1').value)
.between("surface",parseFloat($w('#dropdown6').value), parseFloat($w('#dropdown7').value)) .between("price",parseFloat($w('#dropdown3').value), parseFloat($w('#dropdown4').value)))
-> Here code for checkbox to include in the search.................................
Multi-Select Dropdown
Create a dropdown menu with checkboxes and search a database using multiple filters.