Hello all,
Been trying to get the code for a search bar to work and dont seem to be having any luck. I followed the example done by Yisrael but it didn’t quite work as it doesn’t detail the full process/ set up.
For some context I am trying to add a search bar to my eCommerce site header to enable a user to search for any product on any page and it link you to it once enter is pressed (AKA what all other eCommerce sites have, as shown in the image below.
I have a database with all my products within it but I cant seem to get it work. The image below shows the headings
I have set my search bar up as an input with the database link (the source of the database data is automatically done when a product is added to the website)
The code I used was:
import wixData from “Wix-data”;
export function iTitle_keyPress(event,$w) {
console.log($w(‘#iTitle’).value);
}
function filter(title) {
$w(‘#dataset1’).setFilter(wixData.filter().contains(‘Name’,title));
}
but when I search nothing comes up.
Any help would be really appreciated,
Thanks,
Jordan