Thx for y answer! Well i use code for the search bar but not for the the dropdown yet! In the dataset there is a column for the shops, so i would like to filter the results after the search! So i guess i need to make an onChange with the dropdown, but i dont know where to start actually! So this is my code so far! I have a search in startpage who shows the result in that page! My DB is quite big, but with title, description pricing, link, and shop!
import {local} from ‘wix-storage’ ;
import wixData from ‘wix-data’ ;
$w.onReady( function () {
var sameWord = local.getItem( “searchWord” );
$w( "#searchBar" ).value = sameWord;
//$w(“#searchBar”).placeholder = sameWord;
$w( '#dataset3' ).onReady( **function** () {
search();
});
});
let debounceTimer;
export function searchButton_click() {
//Add your code for this event here:
$w( "#loadingGif" ).show();
if (debounceTimer) {
clearTimeout(debounceTimer);
debounceTimer = undefined;
}
debounceTimer = setTimeout(() => {
$w( "#dataset3" ).setFilter(wixData.filter().contains( "title" , $w( '#searchBar' ).value)
.or(wixData.filter().contains( "shop" , $w( '#searchBar' ).value)))
.then(() => {
count();
})
}, 200 );
search();
}
function count() {
let total = $w( ‘#dataset3’ ).getTotalCount();
if (total > 1 ) {
$w( '#textResults' ).text = `${total} nachhaltige Produkte gefunden.`;
$w( "#loadingGif" ).hide();
$w( '#textResults' ).show();
}
if (total === 1 ) {
$w( ‘#textResults’ ).text = ${total} nachhaltiges Produkt gefunden.
;
$w( “#loadingGif” ).hide();
$w( ‘#textResults’ ).show();
}
if (total === 0 ) {
$w( ‘#textResults’ ).text = “Leider nichts gefunden. Bitte probiere einen ähnlichen Begriff” ;
$w( “#loadingGif” ).hide();
$w( ‘#textResults’ ).show();
}
}
function search() {
wixData.query( 'Produkte2020NEU' )
.contains( 'title' , $w( "#searchBar" ).value)
.or(wixData.query( 'Produkte2020NEU' ).contains( 'shop' , $w( "#searchBar" ).value))
.or(wixData.query( 'Produkte2020NEU' ).contains( 'kategorie' , $w( "#searchBar" ).value))
.limit( 10 )
.ascending ( "preis" )
.find()
.then(res => {
$w( ‘#repeater3’ ).data = res.items;
});
}