Closed bennypowers closed 7 years ago
Hi!
I'm pretty sure the problem here is that your tags
property is actually contained in a value
object for each item.
When you set a value in poly-filter
's filter-by
attribute, it is searching for it only in the first level properties of each item. In your example, it only finds the name
and value
properties, and no tags
, because it is a second level property. That's why your filtered-array
is always empty.
Yeah the filter-by
functionality could use a bit more work. You can probably circumvent this by setting in the filter-by
an array with both value
and tags
: ['value', 'tags']
.
I decided to make my life easier by fixing up my _toArray
method and using a separate one on the tags array. now my model is much simpler going in and I can just filter by tags. I'll close because I'm satisfied but I'll bet someone can come up with a use case here ;)
FYI v1.3.0 now support this, by setting the filter-by
attribute to 'value.tags'
(or ['value.tags']
).
The way to circumvent your problem that is suggested in my previous comment does not work starting with v1.3.0.
Hello! I've got an array like so:
I'd like to filter the array for tags. i.e. Filter by "Blog" or "Branding". I've tried:
But this returns an empty array when given a truthy string to filter by. Any pointers appreciated.