Creating a Content Dropdown filter using Booleans

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.

What do you mean? For the first “” after the three equal signs?

@yonahsadeh I mean that if the “Starting Your Kvutzah” (for example) is the dropdown option label and not the value, it’s not going to work.
Be sure to use the value.

@jonatandor35 Ohhh I understand now, I’ll make those changes and see if it works. Thank you!

Okay so I did that, and one of them works! I’m a bit confused about why not all of the filters work, do you have any ideas? I double checked all the names and ID’s and they all seem to match

Make sure you use the value (and not the label) for all the filters.