Hey, I am trying to make a search bar to search through a collection list. The weird thing is that I copy and pasted this code from another search bar I made in another part of the website. That search bar works fine…This one does not.
let debounceTimer;
export function searchBar_keyPress(event, $w) {
if (debounceTimer) {
clearTimeout(debounceTimer);
debounceTimer = undefined;
}
debounceTimer = setTimeout(() => {
filter($w(‘#searchBar’).value);
},200);
}
let lastFilterTitle
function filter(title) {
if (lastFilterTitle!== title) {
const byFirstName = wixData.filter().contains(‘studentFirstName’, title);
const byLastName = wixData.filter().contains(‘studentLastName’, title);
$w("#youthGroup").setFilter(byFirstName.or(byLastName));
lastFilterTitle = title;
}
}