Reputation: 16534
I have this JS Bin which is using the latest ember and demonstrates my issue. I have 2 lists. one is bound to the ArrayController 'content' and the other is bound do a property function called 'filtered' which filters out certain records. When You add a new record (use the add new link above the lists) you can see that the new record does make it into the content, but the filtered list does not update. What do I need to do so that the ArrayController will see that there is a new record in the list, and re-render the {{#each filtered}}
block?
Upvotes: 0
Views: 138
Reputation: 19128
The dependent key of your computed property filtered
is wrong, you need to use content.length
, because filtered
depends of some change in content
property not the filtered itself:
filtered:function() {
return this.get("content").reduce(function (arr, object, index) {
if(object.get("id") != 2) {
arr.pushObject(object);
}
return arr;
}, Em.A());
}.property("content.length")
Updated jsbin http://jsbin.com/okAKAnU/1/edit
Upvotes: 1