# Filtering hasMany relationship data and using itemController in templates

**URL:** <https://discuss.emberjs.com/t/filtering-hasmany-relationship-data-and-using-itemcontroller-in-templates/5445>\
**Category:** Ember Data\
**Created:** [May 28, 2014, 9:55am UTC](https://discuss.emberjs.com/t/filtering-hasmany-relationship-data-and-using-itemcontroller-in-templates/5445 "2014-05-28T09:55:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mopnexi](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/mopnexi/32/15818_2.png) [@mopnexi](https://discuss.emberjs.com/u/mopnexi)\
**Post date:** [May 28, 2014, 9:55am UTC](https://discuss.emberjs.com/t/filtering-hasmany-relationship-data-and-using-itemcontroller-in-templates/5445/1 "2014-05-28T09:55:06Z")

</div>

I’ve had issues in the past on how to correctly approach filtering data in hasMany relationships. I’ve used Ember.RSVP.hash to return a filtered set of items, but this creates an issue with itemController - I can not use it for that filtered hash of items. I have a property on the itemController that is calculated for each item, and as the result of this type of filtering is a hash of items, it does not work.

For example, I have a “Product” model that hasMany “Shop”. I want to display this information and filter the Shops and Products based on userinput in Ember.TextField. Filtering both “Shop” and “Product” in the view.

1 Product information

- shop
- shop

2 Product information

- shop
- shop

I am trying to figure out how to best approach this type of situation in a more Ember-way. Here’s what I’ve done now: [javascript - Using itemController property for items filtered using RSVP.hash - Stack Overflow](http://stackoverflow.com/questions/23830238/using-itemcontroller-property-for-items-filtered-using-rsvp-hash)

I’m interested in how this should be done in Ember, and if anyone has any examples to give.

Here’s and Ember.js JSBin illustrating my problem. Check with Ember inspector before & after filtering, how the itemController finalPrice property changes from a value to NaN with filtered data: [http://emberjs.jsbin.com/cenolili/21](http://emberjs.jsbin.com/cenolili/21)

---

<div class="post-metadata">

**Author:** ![mopnexi](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/mopnexi/32/15818_2.png) [@mopnexi](https://discuss.emberjs.com/u/mopnexi)\
**Post date:** [July 30, 2014, 7:54am UTC](https://discuss.emberjs.com/t/filtering-hasmany-relationship-data-and-using-itemcontroller-in-templates/5445/2 "2014-07-30T07:54:37Z")

</div>

Any pointers? I’m still stuck with this issue 😄
