Hi Everyone
according to the WIX Tutorial
I have created search bar for the database of my web page.
But, in last step of the coding, I do something wrong, and I do not know, what it is.
When selecting “ALL DEPARTMENTS” = “ALLE ABTEILUNGEN”, the table stays EMPTY, when should be, basically full. >>>
https://www.silverandstars.net/copy-of-datenbank-02-1
Any assistance? Thank you in advance!
For your help, this picture:
the CODE:
import wixData from “wix-data”;
$w.onReady(() => {
wixData.query(‘Beschaftigung’)
.find()
.then(res => {
let options = [{“value”: ‘’, ‘label’: ‘Alle Abteilungen’}];
options.push(…res.items.map(beschaftigung => {
return {‘value’: beschaftigung.title, ‘label’: beschaftigung.title};
}));
$w(‘#iBeschaftigung’).options = options;
});
});
let lastFilterTitle;
let lastFilterBeschaftigung;
let debounceTimer;
export function iAbout_keyPress(event,$w) {
if (debounceTimer) {
clearTimeout(debounceTimer);
debounceTimer = undefined;
}
debounceTimer = setTimeout(() => {
filter($w(‘#iAbout’).value, lastFilterBeschaftigung);
},500);
}
function filter(title, beschaftigung) {
if (lastFilterTitle !== title || lastFilterBeschaftigung !== beschaftigung) {
let newFilter = wixData.filter();
if (title)
newFilter = newFilter.contains(‘about’, title);
if (beschaftigung)
newFilter = newFilter.eq(‘beschaftigung’, beschaftigung);
$w(‘#dataset1’).setFilter(newFilter);
lastFilterTitle = title;
lastFilterBeschaftigung = beschaftigung;
}
}
export function iBeschaftigung_change(event, $w) {
filter(lastFilterTitle, $w(‘#iBeschaftigung’).value);
}