How to change sortProperties value dynamically inside ember.js ArrayController

I am using ember 1.0 pre and have a basic array controller that starts with the default sort property 'id'

PersonApp.PersonController = Ember.ArrayController.extend({ content: [], sortProperties: ['id'], updateSort: function(column) { this.set('sortProperties', column); } }); 

I would like to install this dynamically and update dom for free. But when I make a simple setter (shown above), it does not update anything in my view or on dom.

If I need the ability to dynamically update it, how can I do this?

+3
source share
2 answers

sortProperties should be an array, so I don't know if there will be a column in your case. Here is a js script showing dynamic tuning: http://jsfiddle.net/Sly7/jZVJA/22/

+4
source share

This answer does not answer the original question, but I experienced this symptom and had a different root problem.

In my case, I changed sortProperties dynamically, but this did not affect my array of models. The problem was that I was reading my support array from a shell method that did not observe sortProperties , so even though sortProperties updated, my template did not redraw the base array.

Updating my wrapper method to observe sortProperties directly caused the trick.

+1
source share

All Articles