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 ];
}
})
})