Hi, I’m currently working with wix editor to biuld my website, and in 1 of my pages I have a documentary database where you have a search bar and a dropdown menu with all categories so the users can filter all the documentaries by category, for those two aspects I had to use code and it was fine, I watched a tutorial and everything worked fine.
But when I tried to to the exact same process for my page of the Library, where you can also search the Book by title or filter by categorie with a dropdown menu the code didn’t work.
The only change I made was the names of the elements and I added 5 more categories on the Library page, I checked the dataset the page defenitions, everything I can remember, and the code simply does not work.
Can someone help me plz?
Here is the code:
import wixData from “wix-data” ;
export function searchtitle_keyPress(event) {
let SearchValue = $w( “#searchTitleBook” ).value;
$w( “#bookDataset” ).setFilter(wixData.filter().contains( “title” , SearchValue));
}
export function categorydrop_change(event) {
let searchcat = $w( “#categoryDropBook” ).value;
$w( “#bookDataset” ).onReady( () => {
if (searchcat === “Spirituality” ) {
$w( “#bookDataset” ).setFilter(wixData.filter().eq( “spiritualityB” , true ));
}
if (searchcat === “Veganism” ) {
$w( “#bookDataset” ).setFilter(wixData.filter().eq( “veganismB” , true ));
}
if (searchcat === “Ambientalism” ) {
$w( “#bookDataset” ).setFilter(wixData.filter().eq( “ambientalismB” , true ));
}
if (searchcat === “Relegions” ) {
$w( “#bookDataset” ).setFilter(wixData.filter().eq( “relegionsB” , true ));
}
if (searchcat === “Philosophy” ) {
$w( “#bookDataset” ).setFilter(wixData.filter().eq( “philosophyB” , true ));
}
if (searchcat === “Nature” ) {
$w( “#bookDataset” ).setFilter(wixData.filter().eq( “natureB” , true ));
}
if (searchcat === “Music” ) {
$w( “#bookDataset” ).setFilter(wixData.filter().eq( “musiBc” , true ));
}
if (searchcat === “Art” ) {
$w( “#bookDataset” ).setFilter(wixData.filter().eq( “artB” , true ));
}
if (searchcat === “Drugs” ) {
$w( “#bookDataset” ).setFilter(wixData.filter().eq( “drugsB” , true ));
}
if (searchcat === “Science” ) {
$w( “#bookDataset” ).setFilter(wixData.filter().eq( “scienceB” , true ));
}
if (searchcat === “Old Civilizations” ) {
$w( “#bookDataset” ).setFilter(wixData.filter().eq( “oldCivilizationsB” , true ));
}
if (searchcat === “Yoga” ) {
$w( “#bookDataset” ).setFilter(wixData.filter().eq( “yogaB” , true ));
}
if (searchcat === “Meditation” ) {
$w( “#bookDataset” ).setFilter(wixData.filter().eq( “meditationB” , true ));
}
})
}