I would like to use the same concept used by @yisrael-wix in this example to filter from a repeater using a dataset but i want check box to be independent of the other check boxes either in same group checkbox or other groups check boxes.
Here are the codes from @yisrael-wix
import wixData from 'wix-data';
$w.onReady(function () {
filterView();
$w("#checkboxGroup1").onChange( (event, $w) => {
filterView();
});
$w("#checkboxGroup2").onChange( (event, $w) => {
filterView();
});
});
function filterView(){
var typeFilter = $w("#checkboxGroup1").value
var lightFilter = $w("#checkboxGroup2").value
console.log('type', typeFilter);
console.log('light', lightFilter);
$w("#dataset1").setFilter( wixData.filter()
.hasSome("type", typeFilter)
.hasSome("light", lightFilter)
)
.then( () => {
let count = $w("#dataset1").getTotalCount();
if(count === 0){
$w("#group1").show();
}else{
$w("#group1").hide();
}
} )
.catch( (err) => {
console.log(err);
} );
}
in this example of @Yisrael (Wix) selecting plant type does not filter anything until you make a selection on the Lighting requirements i don’t want mine to work that way, i want each checkbox to work independently.
The question is, what should i alter in the above code to ensure each selection is independent?
I am looking forward for an help. Thanks