I’m trying to make a search box that can search through a database I made and display the results with its corresponding fields and details on a repeater, which also displays the said database. I put up some code and no error happened. But the search box can’t be typed into. You can’t type anything. Can you help me out?
import wixData from 'wix-data';
let lastFiltersearch
let debounceTimer
$w('#CBSbar').onKeyPress((event) => {
update()
function update() {
if (debounceTimer) {
clearTimeout(debounceTimer);
debounceTimer = undefined;
}
debounceTimer = setTimeout(() => {
filter($w("#CBSbar").value);
}, 200);
}
function filter(search) {
let totalResults = 10
if (lastFiltersearch !== search)
wixData.query("CBSLessons")
.contains("title", search)
.or(
wixData.query("CBSLessons")
.contains("subTitle", search)
)
.or(
wixData.query("CBSLessons")
.contains("uploadDate", search)
)
.or(
wixData.query("CBSLessons")
.contains("description", search)
)
.limit(totalResults)
.find()
.then((results) => {
$w("#CBSbox").data = results.items;
});
}
});