javascript - I can't seem to get list.js to filter items with multiple categories -
i'm using list.js sort list of items category. it's easy make work if each list item fits in 1 category, struggling making sort correctly if assigned more 1 category.
basically, want able tag things both beverage , game. i'm not cycling through array i've created each item's categories correctly... ever acknowledges first item?
there isn't in docs of list.js how use in manner. found issue list.js maintainer marked closed seemed related, told person ask on here, that's i'm trying. https://github.com/javve/list.js/issues/189
i think problem
for (var i=0, j=trythis.length; i<j; i++) { if (trythis[i] == selection) { return true; } else { return false; } }
if first category fits, return true, if first not fit return false, preventing more compares.
you should not return false within loop after loop, when know no category match.
===== update
featurelist.filter(function(item) {
this call, change list, or return filtered list?
if returns filtered list (as usual way) never saves returned values?
to save values returned filter function assign return value.
list = list.filter(function(i) { });
if works in case depends on design of filter function, try it.
Comments
Post a Comment