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
2 Product information
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: 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