Multiple Checkbox filter

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.

Did you try the example? You can open it in your Editor and try it out yourself. You can then modify it for your own needs.

When I open your page in the Editor, I can’t open the page code.

See how to Enable Corvid on your site .

If you need further details or clarification, I would recommend contacting Wix Customer Care , as they know best.

Oh, thank you.

It works in my page, but only with text fields. How can I cange this to boolean ?

Here are my boolean fields in my dataset.

function filterView(){
 var typeFilter = $w("#checkboxGroup1").value
 
    console.log('type', typeFilter);
 
    $w("#dataset1").setFilter( wixData.filter()
    .hasSome("type", typeFilter)
    )

    .then( () => {
 let count = $w("#dataset1").getTotalCount(); 
 if(count === 0){
                $w("#group2").show();
            }else{
                $w("#group2").hide();
            }
    } )
    .catch( (err) => {
    console.log(err);
    } );
}