Last active
September 16, 2015 09:47
-
-
Save spenoir/0edca0ec8bb94c72aefc to your computer and use it in GitHub Desktop.
Just adding this simple method to your false template Marionette views makes them work the way I expect
This file contains 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
// A Marionette Collection or Composite view | |
... | |
// prevent the existing view.el from being cleared by rendering | |
attachHtml: function (collectionView, childView, index) { | |
return (typeof childView.template === 'boolean' && !childView.template) ? false : Marionette.CollectionView.prototype.attachHtml.apply(this, arguments); | |
}, | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Useful for preventing a re-render when you want to preserve the html of a views element . Complex form html for example or a google map. You can still call render() to refresh event delegation etc.