Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to filterBy multiple values in emberjs?

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.

like image 988
FutoRicky Avatar asked Jan 23 '15 19:01

FutoRicky


1 Answers

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.

like image 126
Kalman Avatar answered Sep 17 '22 22:09

Kalman