如何在ember.js ArrayController内动态修改sortProperties值 [英] How to modify the sortProperties value dynamically inside an ember.js ArrayController
问题描述
PersonApp.PersonController = Ember.ArrayController.extend({
content:[],
sortProperties:['id'],
updateSort:function(column){
this .set('sortProperties',column);
}
});
我想动态设置,并免费更新dom。但是当我做一个简单的设置器(如上所示),它不会更新我的视图或dom中的任何东西。
如果我需要动态更新动态的功能我可以去吗?
sortProperties
必须是一个数组,所以我不知道在你的情况下,列
是一个。
这是一个js小提琴,显示您动态设置它: http://jsfiddle.net/Sly7 / jZVJA / 22 /
I'm using ember 1.0 pre and have a basic array controller that starts out with a default sort property of 'id'
PersonApp.PersonController = Ember.ArrayController.extend({
content: [],
sortProperties: ['id'],
updateSort: function(column) {
this.set('sortProperties', column);
}
});
I'd like to set this dynamically and have the dom updated for free. But when I do a simple setter (shown above) it doesn't update anything in my view or on the dom.
If I need the ability to update this dynamically how can I go about it?
The sortProperties
must be an array, so I don't know if in your case, column
is one.
Here is a js fiddle showing you dynamically setting it: http://jsfiddle.net/Sly7/jZVJA/22/
这篇关于如何在ember.js ArrayController内动态修改sortProperties值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!