javascript - Find out which individual item changed in an Ember ArrayController -


After

In a Ember.ArrayController , I have a function that is .observes () A property on the entire array of models for a property change

  on FoosController = Ember.ArrayController.extend (Ember.Evented, {observesEachFooBar:. Function () {var less important Things = this.get ('model'); foos.forEach (function (foo) {// test, if this foo has changed, do something}}.}.} () .observes ('.model @ each.bar '),});   

Here I'm testing each Foo in my model manually. How can I avoid this, and only that person has given one (or something) that has changed?

After the

This makes you with the same pattern as the Amber Sourceal Mixin

  foreach (sortProperties, function (sortProperty) {addObserver (item, sortProperty, this 'contentItemSortPropertyDidChange');}, this). ; }, this); } Come back. Super (array, idx, deleted quote, added number); }, InsertItemSorted: function (item) {var arrangedContent = get (this, 'arrangedContent'); Var length = get (systematic content, 'length'); Var idx = this._binary search (item, 0, length); ArrangedContent.insertAt (idx, item); }, ContentItemSortPropertyDidChange: function (item) {var arrangedContent = (it, 'arrangedContent'), oldIndex = arrangedContent.indexOf (items), leftItem = arrangedContent.objectAt (oldIndex - 1), rightItem = arrangedContent.objectAt (oldIndex + 1) , Left side = left item & amp; Amp; This.orderBy (item, leftItem), rightResult = rightItem & amp; Amp; This.orderBy (item, rightItem); If (Baanprkriya & lt; 0 || rightResult & gt; 0) {arrangedContent.removeObject (item); This.insertItemSorted (item); }},    

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -