Dropdown (category filter) code

Hi!
Can anyone help me out with this?
I have created a database and a table to display search results

I want to add a dropdown to filter the results by category, but it doesn’t seem to work… The database id connected to the table.
Here is my code:
export function dropdown_change(event) {
let searchCategory = $w(“#dropdown”).value;
$w(“#dataset1”).setFilter(wixData.filter().contains(“category”, searchCategory));
//Add your code for this event here:
}

Any suggestion would be appreciated.
Regards

Please read about onReady in Dataset docs in The API Docs.

Hi, it seems to kind of work now, but I am having another issue - it doesnt filter category properly, could you please tell me how to fix this?

@op1 I guess you need to connect the Dropdown to the reference field in your dataset or make a function to display unique values only.