Hi!
I created a page for my group with some educational toolkits we created. Each toolkit is in one of six categories. I want to setup a simple dropdown filter, and I found a video that used booleans to filter each item. In the content manager, I added a boolean selector for every toolkit, and marked them true if they were a part of the category. I then added this code into the page:
$w.onReady (function () {
}) ;
export function categoryDropdown_change(event) {
let filterCategory = $w("#categoryDropdown").value;
if (filterCategory === "Starting Your Kvutzah") {
$w("#dataset1").setFilter(wixData.filter().eq("startingYourKvutzah", true));
}
if (filterCategory === "Organizing Strategies") {
$w("#dataset1").setFilter(wixData.filter().eq("organizingStrategies", true));
}
if (filterCategory === "Advocacy") {
$w("#dataset1").setFilter(wixData.filter().eq("advocacy", true));
}
if (filterCategory === "Judaism and Climate") {
$w("#dataset1").setFilter(wixData.filter().eq("judaismAndClimate", true));
}
if (filterCategory === "Individual Action") {
$w("#dataset1").setFilter(wixData.filter().eq("individualAction", true));
}
if (filterCategory === "Food Systems and Climate Change") {
$w("#dataset1").setFilter(wixData.filter().eq("foodSystems", true));
}
}
I tried this code, but nothing seems to be filtering when I use it. Could anyone more experienced than me take a look at this code and help me out? Thank you!
-Yonah
Make sure you're using the selected dropdown value and not the selected dropdown label.