Repeater Filter only shows multiple items if they have same itemName.

this code will return a filtered repeater with no items if the search is “a text” when there are repeats with names “a text”, “b text”, “c text”

this code will return all items if the names are the same ie “a text”, “b text”

//How can I filter and return multiple items with part of the search string?
$w(“#datasetMainData”).setFilter(wixData.filter().contains(“subData”, item.subData._id));

//example of the code below that filters a repeater

var foundfItems;
export function buttonSearch_click(event, $w) {
wixData.query(“Main_Data”)
.include(“subData”)
.find()
.then(res => {
res.items.forEach((item) => {
let itemName = item.subData.itemName;
let subItem = item;

if (itemName.toLowerCase().includes($w(“#iSearchRepeater”).value.toLowerCase())) {

             foundItems.append(item.subData._id); 
            //console.log(itemName); 
            //console.log(item); 

//$w(“#datasetMainData”).setFilter(wixData.filter().contains(“subData”, item.subData._id));
}
});
});

1 Like

this wont add wont work the array doesnt work!

foundItems.append(item.subData._id);

hasSome() is reqd in a wixfilter however you cant make a filter without first creating an array.