Hello everyone,
So I have a repeater that is connected to a data set (a list of webinars) which has 5 key fields. One of the key fields is the webinar title and the speaker of the title. Now, I added a code that would take what the user wrote in the input box and filter the results with the input value of the user with the webinar titles, the list will change according to what the user writes into the box. I’m trying to make the same input box search for two input key fields (webinar title & speaker name) rather than having two input fields.
Here is where I got to up till now:
let lastFilterTitle;
let debounceTimer;
export function iTitle_keyPress(event, $w) {
if (debounceTimer) {
clearTimeout(debounceTimer);
debounceTimer = undefined;
}
debounceTimer = setTimeout(() => {
filter($w('#iTitle').value);
}, 500);
}
function filter(webinarTitle) {
if (lastFilterTitle !== webinarTitle) {
let newFilter = wixData.filter();
if (webinarTitle)
newFilter = newFilter.contains('webinarTitle', webinarTitle);
$w('#dataset1').setFilter(newFilter);
}
}
I also attached two screenshots of the whole operation in action.
Appreciate the help in advance, thank you