Hello,
I have a page on my website using Velo code to connect to a selection tag. When a tag is clicked, the data is filtered, only showing the people that work at the specific selection tag.
I also have a dataset filter to only show people who have a boolean "true" in one of the columns. However, when I click the selection tag, it no longer uses the dataset filter and displays people I don't want it to.
Here's the code I have so far for selection tags:
import wixData from 'wix-data'; const databaseName = 'Team'; const databaseField = 'locations'; $w.onReady(function () { $w('#selectionTags1').onChange((event) => { const selectedTag = $w('#selectionTags1').value; addItemstoRepeater(selectedTag); }) }); function addItemstoRepeater(selectedOption = []) { let dataQuery = wixData.query(databaseName); if (selectedOption.length > 0) { dataQuery = dataQuery.hasSome(databaseField, selectedOption); } dataQuery .find() .then(results => { const filtereditemsReady = results.items; $w('#repeater1').data = filtereditemsReady; }) }
I want to add a line in there somewhere to say "after filtering with the selection selection tag, apply column filter in dataset," but I don't know where to begin.
The column name is visibleOnProvidersPage. The value needs to be true for them to be displayed.
The content database name is Team.
Hi, I am having the same issue as you. Did you manage to find a solution?
I have set a dataset filter to the page so it only shows relevant items. Selection tabs narrow down the items as they should, but upon deselecting the tags, I see all the unfiltered items which weren't originally on the page
Either work with a dataset or with direct queries, but don't mix the together.
If you prefer working with datasets, use dataset,setFilter instead of your queries.
https://www.wix.com/velo/reference/wix-dataset/dataset/setfilter
and always filter for all parameters (it doesn't "remember" the previous filter)