I have a repeater that I have created with some search bars included that filter down all products on my shopping database for easy quick orders. I am trying to add an on click function to a button that will add the selected product from the repeater to the cart. The below code is for the repeater but has the on click event empty as I am not sure where to begin.
// Code for Draffens Search Bar
import wixData from ‘wix-data’;
let debounceTimer;
export function input1_keyPress(event) {
if (debounceTimer) {
clearTimeout(debounceTimer);
debounceTimer = undefined;
}
debounceTimer = setTimeout(() => {
filter($w(‘#input1’).value);
}, 200);
}
let lastFilterTitle;
function filter(title) {
if (lastFilterTitle !== title) {}
$w(‘#dataset1’).setFilter(wixData.filter().contains(‘name’, title))
}
let debounceTimer2;
export function input2_keyPress(event) {
if (debounceTimer2) {
clearTimeout(debounceTimer2);
debounceTimer2 = undefined;
}
debounceTimer2 = setTimeout(() => {
filter2($w(‘#input2’).value);
}, 200);
}
let lastFilterTitle2;
function filter2(title2) {
if (lastFilterTitle2 !== title2) {}
$w(‘#dataset1’).setFilter(wixData.filter().contains(‘sku’, title2))
}
let debounceTimer3;
export function input3_keyPress(event) {
if (debounceTimer3) {
clearTimeout(debounceTimer3);
debounceTimer3 = undefined;
}
debounceTimer3 = setTimeout(() => {
filter3($w(‘#input3’).value);
}, 200);
}
let lastFilterTitle3;
function filter3(title3) {
if (lastFilterTitle3 !== title3) {}
$w("#dataset1").onReady(() => {
let SearchValue = $w(“#input3”).value;
$w("#dataset1").setFilter(
wixData.filter()
.contains("name", SearchValue)
.or(
wixData.filter()
.contains("sku", SearchValue)
.or(
wixData.filter()
.contains("description", SearchValue)
)
)
);
})
}
export function cartButton_click(event) {
}