import wixData from 'wix-data'; $w.onReady(function () { let tags = $w('#tags'); if (tags.value.length === 1) { prevSelectedValue = tags.value[0]; } else if (tags.value.length > 1) { // If multiple tags are selected by default, deselect all of them (since there's no good reason to prefer one of them over the others). tags.value = []; } }); export function selectionTags_change(event) { // Prevent deselecting the only selected tag. Radio buttons do not allow it so tags shouldn't either. if (!event.target.value || event.target.value.length === 0) { // Re-apply the previously selected tag. event.target.value = [prevSelectedValue]; // Replace the previously selected tag with the newly selected one. } else { // Note: Array.filter() was added in ES7. Only works in some browsers. event.target.value = event.target.value.filter(x => x !== prevSelectedValue); prevSelectedValue = event.target.value[0]; } } const collectionName = 'nuevodataset'; const fieldToFilterByInCollection = 'tags'; $w.onReady(function () { setRepeatedItemsInRepeater(); loadDataToRepeater(); $w('#tags').onChange((event) => { const selectedTags = $w('#tags').value; loadDataToRepeater(selectedTags); }) }); function loadDataToRepeater(selectedCategories = []) { let dataQuery = wixData.query(collectionName); if (selectedCategories.length > 0) { dataQuery = dataQuery.hasAll(fieldToFilterByInCollection, selectedCategories); } dataQuery .find() .then(results => { const itemsReadyForRepeater = results.items; const isRepeaterEmpty = itemsReadyForRepeater.length === 0 }) } export function setRepeatedItemsInRepeater() image').src = itemData.image; '#title'.text = itemData.title; })
top of page
Important forum update
This forum is migrating to one unified Wix community forum starting July 26th, and will be read-only during the process.
Wishlist Page is the official platform for requesting new features. You can vote, comment, and track the status of the requested features.
bottom of page
Hi,
What is the issue that you are having exactly? Are you receiving some sort of error in particular?
We have a tutorial that will help you set up filtering your database with a dropdown menu.
Corvid Tutorial: Adding Collection Data Search Functionality
Hope this helps!
Dara | Corvid Team
the idea is to create a dropdown, multichose tag eelemt and display data by filtering them
thanks