I’m working on a general insurance agency website. There are lots of insurance product and I would like to have a search of product by its name, and also to filter it by business activity using a dropdown menu.
For example, if i search for liability product, all the liability solution will appear in repeater. like professional liability, management liability, marine liability etc.
But when I filter by business activity, different products that are relevant to the business will appear in the repeater. Like for retail, then property insurance, work injury compensation, workers’ bond will appear.
I managed to do the search by keywords with the following code:
import wixData from ‘wix-data’;
let debounceTimer;
export function iProduct_keyPress(event, $w) {
if (debounceTimer) {
clearTimeout(debounceTimer);
debounceTimer = undefined;
}
debounceTimer = setTimeout(() => {
filter($w(‘#iProduct’).value);
}, 200);
}
let lastFilterTitle;
function filter(product) {
if (lastFilterTitle !== product) {
$w(‘#dataset1’).setFilter(wixData.filter().contains(‘product’, product))
lastFilterTitle = product;
}
}
But I couldn’t work out the filter by business activity. Appreciate your help.