@russian-dima I couldn’t understand the code you posted, but I managed to get the repeater to show only 1 tag at one time by changing the VALUE in this line
setTimeout(()=>{
$w('#selectionTags1').value = []
$w('#selectionTags1').value = VALUE
},1)
into a number. Any number works.
The problem I have is that when I click a tag, it doesn’t stay highlighted. It does show me the results for it, but not which tag is currently selected.
Would you know how I can fix it?
This is my code as it stands.
$w.onReady(function () {
});
import wixData from 'wix-data';
const databaseName = 'Books';
const databaseField = 'tropes';
$w.onReady(function () {
$w('#selectionTags1').onChange((event) => {
const selectedTag = $w('#selectionTags1').value;
addItemstoRepeater(selectedTag);
})
});
function addItemstoRepeater(selectedOption = [0]) {
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 = [1]
},1)
})
});
Thanks