0
votes

Is it possible to bind the childViews property to one within the controller? Thus,

App.DashboardView = Ember.ContainerView.extend({
  tagName: 'section',
  childViewsBinding: 'controller.viewChildren',
  ...
});

And within the controller, a view object is dynamically created (qryView) and then appended to the controller's array:

this.get('viewChildren').pushObject(qryView.create()); 

I've been trying this but I don't see any change in the containerView's rendering after the array is populated.

Bryan

1

1 Answers

0
votes

I found a way to do this, as binding didn't seem to work. I created an observer in the 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')