Hey guys im tring to use the grep() function to filter my array but im
having problem as the array is returning empty.
what im trying to achive is if the selected category exists in the array
then for it to return the relevant rows.
i've tried different variations in the return but im having no
luck. Any advise would be greatful...thanks guys
selected['categories'] =
-
["Clothes"
,
"Footwear"
]
- filtered_data
= jQuery.grep(data, function(index, item) {
return
($.inArray(item.category, selected['categories']) >
-1);
});
- console.log(filtered_data);