Hello,
I continue my journey into filtering a photo gallery based on a selection of tags in a dropdown menu. I got it to work using this code when the “tags” field in dataset1 is a TEXT field.
export function filterInput_change(event) {
$w(“#dataset1”).setFilter(wixData.filter()
.contains(“tags”, $w(“#filterInput”).value));
}
However, I have made the “tags” field into a multiple item reference field type, and now the filter doesn’t work. Essentially, I want it to take the value of the dropdown down, and see if that value is contained within an entry’s multiple item reference field “tags”
So on the site, when a user picks “Still Life” from the the dropdown, the gallery would be filtered to only photos that have “Still Life” in the Tags field. In this case with only two photos, only the photo of the skull would be displayed.
Any thoughts? You all are awesome, by the way. This forum is incredibly helpful.
Hey there, I was FINALLY able to figure something out. I had such a hard time getting any help on this.
So what I ended up doing was adding a new rich text field to my primary table, and then setting up a hook to copy my multiple reference field data into the new rich text field. Then I made sure the query included the values of the rich text field. The tricky thing was trying to get the multiple reference data to copy over and actually retain its data rather than just showing up as an [object Object].
Here’s what I used for my hook. “search” is the rich text field, “categories” is the multiple reference field. Then you just include “search” in your query.
Good luck! I had such a hard time finding any answers or help for this, I’m sure this isn’t the best solution but it’s the best I could come up with. I was really discouraged with trying to get any answers on the forum.