I am trying to remove the fields from accordion list, if its not match with my searchfield name only actual search name should be shown in list. Search functionality working fine. But i cant remove rest of elements from the store. Duplicate occurs
for (var j = length; j--;)
{
console.log(store.data.items[j]);
console.log(store.data.items[j].data.testname);
//store.clearFilter(true);
if (store.data.items[j].data.testname.search(new RegExp(searchfield, "i")) === -1)
{
//store.filter('testname',store.data.items[j].data.testname);
store.data.items[j].remove();
}
}
Output - Type Mango
Expected
Or
Any suggestion.
store.removeAt(j);
You want to remove a record and not only the data. But if you want to remove it only for some time you might want to use
store.filterBy(function() {
your Code
return true only for those you need and false for those unwanted ones
})