Note that there are some explanatory texts on larger screens.

plurals
  1. POEmber view doesn't update after ArrayController is sorted
    primarykey
    data
    text
    <p>I have an Ember Array Controller that is binded to Ember select view that gets sorted by the user if they choose to. Once everything runs through my sort and I reset the array with the now sorted array the view doesn't change but if I loop through the array that I just set, it shows that it is sorted. So the view isn't updating with the array controller, I believe. I was looking at other posts with similar problems but none of the solutions from them worked for me. </p> <pre><code>dmp: Ember.ArrayController.create(), tempArray: new Array(), sort: function() { debugger; var self = this; var textA, textB, i, t, pos, temp; this.set('tempArray', self.dmp.get('content')); var nxt; for(t = 0; t &lt; (self.get('tempArray').length) - 1; t++) { nxt = this.get('tempArray')[t]; for(i = t; i &lt; self.get('tempArray').length; i++) { if(self.get('tempArray')[i].name.toUpperCase() &lt;= nxt.name.toUpperCase()) { nxt = self.get('tempArray')[i]; pos = i; } } temp = self.get('tempArray')[t]; self.get('tempArray')[t] = nxt; self.get('tempArray')[pos] = temp; } //App.defRouteSearch.dmpName.set('content', self.get('tempArray')); //App.defRouteSearch.dmp.set('content', self.get('tempArray')); self.setArray(); }, setArray: function() { debugger; var a = 0, b = 1; var self = this; while(a &lt; this.get('tempArray').length) { self.get('dmp').toArray[b] = self.get('tempArray')[a]; a++; b++; } } </code></pre> <p>I switch everything over to a normal js array because it's quicker to manipulate data than compared to the Array Controller, I do this throughout the rest of my code when filling the 6 other arrays I have so that's not causing any problems. The commented code was what I was doing before to set the array. Thanks for any help.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload