Hey,
I want to filter with multiple checkboxes like in this example from @yisrael-wix :
[https://www.wix.com/code-examples/multi-groups-filter](https://www.wix.com/code-examples/multi-groups-filter)
Here’s my code:
$w.onReady(() => {
$w('#dataset1').onReady(() => {
$w('#checkbox1, #checkbox2').onChange(() => {
search();
})
function search() {
let filter = wixData.filter();
let filterCheckbox1 = $w("#checkbox1").checked;
let filterCheckbox2 = $w("#checkbox2").checked;
if (filterCheckbox1 ) { filter = filter.eq("boolean1", true)
}
if (filterCheckbox2 ) { filter = filter.eq("boolean2", true);
}
$w('#dataset1').setFilter(filter)
}
})
})
The code works, but only for 1 checkbox.
If I check 2 checkboxes, I got no results. When both checkboxes are check, I want to see all results from checkbox1 and checkbox2.
I use individual checkboxes and boolean fields in the dataset.
On the examplepage (link) you can see all results, that contains “Folwers” and “Leaves” when both checkboxes are checked, but there’s no code.
I hope you can help my, I’ve been trying to find a code for over a week.