Just created my first coding (That works! yay) to filter a dataset. However the ‘search/filter’ seems to be case-sensitive. Is there a way to make this non case sensitive?
import wixData from ‘wix-data’ ;
$w . onReady (() => {
$w ( ‘#searchBarInput’ ). onInput (() => filterDataset ());
$w ( ‘#sortDropdown’ ). onChange (() => filterDataset ());
})
function filterDataset () {
let filter = wixData . filter ();
let sort = wixData . sort ();
let searchValue = $w ( ‘#searchBarInput’ ). value ;
let sortValue = $w ( ‘#sortDropdown’ ). value ;
if ( searchValue . length > 0 ) { filter = filter . contains ( ‘artist’ , searchValue ). or ( filter . eq ( ‘title’ , searchValue )) }
switch ( sortValue ) {
case ‘a-z’ :
// Sort the products by their name: A - Z
sort = sort . ascending ( ‘artist’ );
break ;
case ‘z-a’ :
// Sort the products by their name: Z - A
sort = sort . descending ( ‘artist’ );
break ;
case ‘titleAse’ :
// Sort products by their price: Low - High
sort = sort . ascending ( ‘title’ );
break ;
case ‘titleDse’ :
// Sort products by their price: High to Low
sort = sort . descending ( ‘title’ );
break ;
}
$w ( '#dataset1' ). setFilter ( filter ). then (() => $w ( '#dataset1' ). setSort ( sort ));
}
Thanks in advance
Danny😊