Is it possible to filterBy multiple values in emberjs?
I am trying to filter items in a table with different filtering variables and I'm having trouble doing so with more than one of those variables.
Can anyone help out? I'm ne to emberjs and eager to learn. Thanks in advance.
You can't pass multiple properties into the same filterBy
, but you can filterBy
on the same array 2 times, i.e. chain your filterBy
calls if that makes sense.
See the following answer I recently gave (here) for a working demo of what I am talking about
So, in short, if you have an array arr and you want to filter it by country
and name
properties for example, you would do:
arr.filterBy('country', countryName).filterBy('name', 'Josh')
You can also just use the filter
(as opposed to filterBy
) method and filter things any way you would like.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With