Jul 232012
Programming in javascript: CompositeView and ItemView, how to handle two views and templates? on newest questions tagged javascript – Stack Overflow
I have the following CompositeView(1).
I am wondering what is the best way, for each model of MyCollection, to render two templates and views in order to make something like that(2).
(1)
var MyCompositeView = Marionette.CompositeView.extend({
template: myTemplate,
itemView: myView,
collection: new MyCollection(),
initialize: function () {
this.collection.fetch();
},
appendHtml: function (collectionView, itemView) {
collectionView.$el.find('ul').append(itemView.el);
}
});
(2)
appendHtml: function (collectionView, itemView1, itemView2) {
collectionView.$el.find('ul').append(itemView1.el);
itemView.$el.append(itemView2.el);
}
See Answers
source: http://stackoverflow.com/questions/11610779/compositeview-and-itemview-how-to-handle-two-views-and-templates
Programming in javascript: programming-in-javascript
Recent Comments