Get query params using the Wix Location API . Then filter using the result.
Second option is to store users input in storage and on the relevant page get it from the storage and use to filter content. Click here to learn about Wix storage.
Is it also possible to filter by params with mutiple values? ?tags=one, two, three
I like to show the entries with the tags one, two and three (with one tag it works nice).
Thanks again!
Here is my code so far:
import wixLocation from ‘wix-location’; import wixData from ‘wix-data’; const collectionName = ‘Testservices’; const fieldToFilterByInCollection = ‘tags’;
$w.onReady( function () { const selectedTags = wixLocation.query[“tags”];
$w(‘#tags’).value = wixLocation.query[“tags”];
setRepeatedItemsInRepeater()
loadDataToRepeater(selectedTags)
}); function loadDataToRepeater(selectedCategories = []) { let dataQuery = wixData.query(collectionName) if (selectedCategories.length > 0) {
dataQuery = dataQuery.hasAll(fieldToFilterByInCollection, selectedCategories)
}