当加载具有多个集合的视图和主视图的多个子视图时,如何等待所有内容加载并使用所有数据呈现视图。有人可以给我一些关于如何做的示例代码
主链:
initialize: function() {
this.data = this.model.toJSON();
this.collections = [];
this.collections[0] = new category.CategoriesCollection({ });
this.collections[0].fetch();
this.childViews = [];
this.childViews[0] = new ImageViewCollection({ collection: new ImageCollection() });
//this.model.on('add', this.render(), this);
for(var i = 0; i < this.collections.length; i++) {
this.listenTo(this.collections[i], 'add', this.render());
}
},