Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ember.js/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ember.js ContainerView子视图绑定_Ember.js_Dashboard - Fatal编程技术网

Ember.js ContainerView子视图绑定

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

是否可以将ChildView属性绑定到控制器中的一个?因此,

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获取所有动态添加宽度的值