javascript - Using Marionette CollectionView to create multiple views per item -
i have marionette.collectionview items (models) need create 2 views run on model, can marionette.collectionview.builditemview return 2 views?
edit:
i don't want create wrapperitemview, have solution running right want make more standart.
i want code this, there simple way make work?
builditemview: function(item){ // create 2 views based on item type return [view1, view2]; }, appendhtml: function(collectionview, itemview, index){ if (itemview.type === "x" ) collectionview.$el.find(".a").append(itemview.el); if (itemview.type === "y" ) collectionview.$el.find(".b").append(itemview.el); }
why dont itemview acts father of second view, can create second view in initialize function of item view.
edit
i still create perent view time make parent of 2 views, collection create parent , parent create 2 views inside of it.
this way more natural me.
Comments
Post a Comment