I'm using list.js to do some simple filtering on a list - but running in to a little snag.
Some items in the list may look like this:
<li class="grid-item" data-attribute="attr1, attr2, attr3" data-attributeTwo="a2">
The filters that you click look like this:
<li data-filter="attr1">Attr1</li>
<li data-filter="attr2">Attr1</li>
<li data-filter="attr3">Attt3</li>
And I have my filter function set up like this:
$('.filter-nav ul li').on('click', function() {
var filterValue = $( this ).attr('data-filter');
list.filter(function(item) {
if (
item.values().attribute == filterValue ||
item.values().attributeTwo == filterValue ||
) {
return true;
} else {
return false;
}
});
return false;
});
Is it possible to filter those comma separated attributes by their values respectively? As in, I could click Attr1, Attr2, or Attr3 and the filter would spit out what's appropriate?