Hi,
I have two filter boxes that display results from a repeater dataset. I’d like to add the functionality of showing a message saying “no results found” when the filters are added and there are no relevant results.
This is my code for the filter function. I also have the text box added to the site and hidden called #textNoRes
I’ve looked through the forum and tried to add this myself using different pieces of code but can’t seem to figure out the correct combo.
import wixData from ‘wix-data’ ;
$w . onReady ( function () {
$w ( “#dataset1” ). onReady (() => {
$w ( “#repeater1” ). onItemReady (( $item , itemData , index ) => {
$item ( “#textDateType” ). text = itemData . dates + ", " + itemData . time + " | " + itemData . courseType ;
$item ( “#textTitle” ). text = itemData . title ;
$item ( “#textInstructorLocation” ). text = itemData . instructorName + " | " + itemData . location ;
})
});
});
export function dropdown1_change ( event ) {
$w ( “#dataset1” ). setFilter ( wixData . filter ()
. eq ( “ce” , true )
. contains ( “courseType” , $w ( “#dropdown1” ). value )
. contains ( “instructorName” , $w ( “#dropdown2” ). value )
)
. then (()=>{
$w ( “#boxClear” ). expand ();
})
}
export function dropdown2_change ( event ) {
$w ( “#dataset1” ). setFilter ( wixData . filter ()
. eq ( “ce” , true )
. contains ( “courseType” , $w ( “#dropdown1” ). value )
. contains ( “instructorName” , $w ( “#dropdown2” ). value )
)
. then (()=>{
$w ( “#boxClear” ). expand ();
})
}
export function buttonClear_click ( event ) {
$w ( “#dropdown1” ). value = undefined ;
$w ( “#dropdown2” ). value = undefined ;
// $w(“#dropdown3”).value = undefined;
$w ( “#boxClear” ). collapse ();
$w ( “#dataset1” ). setFilter ( wixData . filter ()
. eq ( “ce” , true )
)
}
Thank you for your help!