HELP: Drop Down Search Bar

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);
}

Hi,
Check this out:

export function iBeschaftigung_change(event, $w) {
	if ($w('#iBeschaftigung').value === 'Alle Abteilungen') {
		return filter();
	}
	filter(lastFilterTitle, $w('#iBeschaftigung').value);
}

Change iBeschaftigung_change function to the one above.
Please update in your progress.
Roi.

hello! I have the same problem where the search dropdown only lists blank pages instead any information! Is there any help that I can get with this? any option only shows a blank page.
I modified the code as suggested above but it doesn’t work!

the search bar works perfectly fine though, but the dropdown doesn’t work at all! thank you in advance if i can get some help!! ive been working on this thing alone for days but my other posts haven’t gotten any responses :confused:

below are the codes that i used

import wixData from "wix-data";

$w.onReady(() => {
  wixData.query('projectType')
	  .find()
	  .then(res => {
	  	let options = [{'value': '', "label": 'All Project Types'}];
	  	options.push(...res.items.map(project => {
	  		return {"value": project.title, "label": project.title};
	  	}));
	  	$w('#iType').options = options;
	  });
});

  
let lastFilterTitle;
let lastFilterProject;
let debounceTimer;

export function iTitle_keyPress(event, $w) {
  if (debounceTimer) {
    clearTimeout(debounceTimer);
    debounceTimer = undefined;
  }
  debounceTimer = setTimeout(() => {
    filter($w('#iTitle').value, lastFilterProject);  
  }, 500);
}


function filter(title, project) {
  if (lastFilterTitle !== title || lastFilterProject !== project) {
    let newFilter = wixData.filter();
    if (title)
      newFilter = newFilter.contains('groupName', title);
    if (project)
      newFilter = newFilter.contains('projectType', project);
    $w('#dataset1').setFilter(newFilter);		
    lastFilterTitle = title; 
    lastFilterProject = project;
  }
}

export function iType_change(event, $w) {
	if ($w('#iType').value === 'All Project Types') {
		return filter();
	}
	filter(lastFilterTitle, $w('#iType').value);
}

Thank you very much, Roi, it is working perfectly!
Thanks, Rae, for your efforts!