Created
April 2, 2017 15:05
-
-
Save paulfalgout/e55bb0813e2d45e4cbc42801f2d9412a to your computer and use it in GitHub Desktop.
NextCompositeView Alt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var NextCompositeView = Marionette.NextCollectionView.extend({ | |
constructor: function(options) { | |
Marionette.NextCollectionView.call(this, options); | |
this.templateView = new Marionette.View(_.pick(this, ['el','template','ui','model'])); | |
}, | |
childView: function() { | |
return this.constructor; | |
}, | |
getChildViewContainer: function() { | |
var selector = _.result(this, 'childViewContainer'); | |
return selector ? this.findEls(selector, this.$el) : this.$el; | |
}, | |
onBeforeRender: function() { | |
this.templateView.render(); | |
this.$childViewContainer = this.getChildViewContainer(); | |
}, | |
attachHtml: function(collectionView, els) { | |
this.appendChildren(this.$childViewContainer, els); | |
}, | |
onBeforeDestroy: function() { | |
this.templateView.destroy(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment