Skip to content

Instantly share code, notes, and snippets.

@spenoir
Last active September 16, 2015 09:47
Show Gist options
  • Save spenoir/0edca0ec8bb94c72aefc to your computer and use it in GitHub Desktop.
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
// 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);
},
...
@spenoir
Copy link
Author

spenoir commented Jul 13, 2015

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment