Ember.js ContainerView子视图绑定
是否可以将ChildView属性绑定到控制器中的一个?因此,Ember.js ContainerView子视图绑定,ember.js,dashboard,Ember.js,Dashboard,是否可以将ChildView属性绑定到控制器中的一个?因此, App.DashboardView = Ember.ContainerView.extend({ tagName: 'section', childViewsBinding: 'controller.viewChildren', ... }); 在控制器中,动态创建视图对象(qryView),然后将其附加到控制器的数组中: this.get('viewChildren').pushObject(qryView.creat
App.DashboardView = Ember.ContainerView.extend({
tagName: 'section',
childViewsBinding: 'controller.viewChildren',
...
});
在控制器中,动态创建视图对象(qryView
),然后将其附加到控制器的数组中:
this.get('viewChildren').pushObject(qryView.create());
我一直在尝试这一点,但在填充数组后,我看不到containerView的渲染有任何变化
布莱恩我找到了一种方法,因为绑定似乎不起作用。我在containerView中创建了一个观察者:
App.DashboardView = Ember.ContainerView.extend({
tagName: 'section',
updChildViews: (function() {
var children, ths;
try {
ths = this;
children = this.get('controller.viewChildren');
children.forEach(function(chld) {
if (!ths.get('childViews').contains(chld)) {
ths.pushObject(chld);
}
});
} catch (e) {
console.error("DashboardView.updChildViews error:", e);
}
}).observes('controller.viewChildren.@each')
您好bk11425,我也在寻找类似的解决方案。这是我的jsBin——这是我的详细问题,我想根据我的jsBin获取所有动态添加宽度的值