Due to the glitch, I have to click the selection tag twice to ACTUALLY select it. But without that part of the code, multiple tags can be selected.
I have been through all other forum posts regarding this particular issue. Can you please help me with a reference to my particular code only?
import wixData from 'wix-data'; const databaseName = 'Portfolio'; const databaseField = 'tags'; const REPEATER = '#repeater2'; const ST = $w('#selectionTags1') $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('#repeater2').data = filtereditemsReady; }) } $w.onReady(function () { $w('#selectionTags1').onChange(()=>{ let VALUE = $w('#selectionTags1').value let LENGTH = VALUE.length console.log(LENGTH) for (var i = 0; i <= LENGTH-1; i++) { if(LENGTH>1) { VALUE.shift() } else{ } } console.log(VALUE) setTimeout(()=>{ $w('#selectionTags1').value = [] $w('#selectionTags1').value = VALUE },1) }) }); $w.onReady(() => { let selectedValue = ''; $w(ST).onChange(({target}) => { const values = target.value; const numOfValues = values.length; if(!numOfValues ){ selectedValue = ''; } else { selectedValue = values.find(e => e !== selectedValue); target.value = [selectedValue]; } }) })
1) https://community.wix.com/velo/forum/coding-with-velo/one-selection-tag-at-a-time-to-filter-gallery
2) https://community.wix.com/velo/forum/coding-with-velo/selection-tags-single-selection
3) https://community.wix.com/velo/forum/site-page-design/select-only-1-selection-tag-for-gallery
4) https://community.wix.com/velo/forum/coding-with-velo/filter-a-repeater-with-only-one-option-using-the-selection-tags-element
Did you already have used the SEARCH of the VELO-FORUM ?
Also do --> NOT <--- use more than --> 1 <-- $w.onReady() <--- inside of your whole code.
A page can get ready JUST ONE TIME --> AT THE VERY BEGINNING !!!