Hi Guys! i need some help. So im working on a website to display the profiles of some members. i want the users to be able to filter with practice area or location or both or to search by name. ive been able to create the two check boxes but its only able to work if the two checkboxes are checked. i also dont know how to add the search filter. PLEASE HELP. This is the code i used for the page
import wixData from ‘wix-data’ ;
$w . onReady ( function () {
filterView ();
$w ( "#checkboxGroup1" ). onChange (( event , $w ) => {
filterView ();
});
$w ( "#checkboxGroup2" ). onChange (( event , $w ) => {
filterView ();
});
});
function filterView ( ) {
var practiseArea2Filter = $w ( “#checkboxGroup1” ). value
var locationFilter = $w ( “#checkboxGroup2” ). value
console . log ( 'practiseArea2' , practiseArea2Filter );
console . log ( 'location' , locationFilter );
$w ( "#dataset1" ). setFilter ( wixData . filter ()
. hasSome ( "practiseArea2" , practiseArea2Filter )
. hasSome ( "location" , locationFilter )
)
. then (() => {
**let** count = $w ( "#dataset1" ). getTotalCount ();
**if** ( count === 0 ) {
$w ( "#group1" ). show ();
} **else** {
$w ( "#group1" ). hide ();
}
})
. **catch** (( err ) => {
console . log ( err );
});
}