Hello all,
I’ve already created a code to filter my dataset/ repeater by different selection tags.
I also want to add 2 dropdown menus to further filter the dataset/ repeater. I am an absolute beginner with wiz velo, so i really don’t know where to add the extra code.
Could somebody please help me with this issue?
That’s the actual code I‘ve got so far:
import wixData from ‘wix-data’;
const collectionName =‘Jobs’;
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;
$w('#Jobs').data = itemsReadyForRepeater;
**const** isRepeaterEmpty = itemsReadyForRepeater.length === 0
**if** (isRepeaterEmpty) {
$w('#resultsnotfound').show();
} **else** {
$w('#resultsnotfound').hide();
}
})
}
function setRepeatedItemsInRepeater() {
$w('#Jobs').onItemReady(($item, itemData) => {})
}