Hi.
I successfully find my 2 days problem by watching the tutorial from youtube about search and dropdown. it really excites me to have it now working. However, i would like to add some feature if possible. I want to add search find result counter [ i don’t know if thats the right term]. I attached screent shot from my google search where it count number of items based on my inquiry.
Scenario: Search mp3
Repeater result: Filtered
Count: No of items search (like in photo attached)
Here’s the code im using right now with search and dropdown.
I DIDN’T add yet any code for the search result counter.
Hope you anyone can guide me well what’s the code and WHERE to attached the code without affecting my codes below.
import wixData from “wix-data”;
$w.onReady(() => {
wixData.query(‘Category’)
.find()
.then(res => {
let options = [{“value”: ‘’, ‘label’: ‘All Tours’}];
options.push(…res.items.map(category => {
return {‘value’: category.title, ‘label’: category.title}
}));
$w(‘#iTours’).options = options;
})
});
let lastFilterTitle;
let lastFilterCategory;
let debounceTimer;
export function iTitle_keyPress(event, $w) {
if (debounceTimer) {
clearTimeout(debounceTimer);
debounceTimer = undefined;
}
debounceTimer = setTimeout(() => {
filter($w(‘#iTitle’).value, lastFilterCategory);
}, 200);
}
function filter(title, category) {
if (lastFilterTitle !== title || lastFilterCategory !== category) {
let newFilter = wixData.filter();
if (title)
newFilter = newFilter.contains(‘title’, title);
if (category)
newFilter = newFilter.eq(‘category’, category);
$w(‘#dataset1’).setFilter(newFilter);
lastFilterTitle = title;
lastFilterCategory = category;
}
}
export function iTours_change(event, $w) {
filter(lastFilterTitle, $w(‘#iTours’).value); //Add your code for this event here:
}
// adding countQuery search
THANK YOU!!