*CODING* How to Create a Search for My Database

My website: https://the-pwr.wixsite.com/fpdl-22/areas-atuacao-1

I implemented a database with all the information that I want displayed on the screen. To make things easier for the audience, I created a search bar and dropdown box to go thru the manus more quickly and efficiently since there are so many.

My Problem begins when I go to search for a keyword in the search bar (on the left), all the boxes bellow with the information disappear. The goal is to have the keywords match was is inside the box and only display what has been searched.

I used this video as a guide " Wix Code | How to Create a Search for Your Database - YouTube "
I am able to follow the coding until minute 2:25. Beyond that point, I cannot seem to get my website to display the information like it does on the video above.

Another problem I am having is with the dropdown menu (on the right)

. I want it to display all the titles of the boxes but every time I try to link it to the database it does not show anything.

This is the coding that I am using on the page.

import wixData from “wix-data”;

let lastFilterTitle;
let debounceTimer;
export function input_keyPress_1(event, $w) {
if (debounceTimer) {
clearTimeout(debounceTimer);
debounceTimer = undefined;
}
debounceTimer = setTimeout(() => {
filter($w(‘#input’).value);
}, 200);
}

function filter(title) {
if (lastFilterTitle !== title) {
$w(‘#dataset1’).setFilter(wixData.filter().contains(‘Intro’, title));
lastFilterTitle = title;
}
}

Here is a visual representation of my issue :

Thanks.

Hi,

I feel the problem in this line
$w(’ #dataset1 ').setFilter(wixData.filter().contains(‘Intro’, title));
are you sure the ‘Intro’ field has the values you are searching for?

Hello,

Even if we replace “Intro” with “Title” - nothing changes, we still can’t get it right.

What else do you suggest we try?

Thanks for you help.

@gabrielpairol could you let me see the database ?
also for the dropdown, do you want to get its values from the database or you have a specific values ?

@ahmdjsalhi How do you want me to share with you my date set?

@gabrielpairol just a screenshot to see the fields.

The content is translated to Portuguese but the method should be the same

I think the filter is working but you need to change Intro to ‘Title’ and write your search in uppercase. try it.

@ahmdjsalhi I tried using all caps and I changed the coding properties from intro to title and nothing shows up still.

Hi @gabrielpairol !

Make sure that you use the field key exactly the way it is shown (lower case) and not the column’s name.

AKA -

$w('#dataset1').setFilter(wixData.filter().contains('title', title));

Doron.