Is it possible to put a view that is already rendered into a backbone marionette region without rendering it again?
For example:
region.show(myView); // This will call render on myView
I don't want the region to render my view again.
If I do:
region.attachView(myView); // This won't render myView, but it also won't show it
First override marionette ItemView constructor and render like this (if you want to use it in CollectionView and CompositeView override these methods of them too):
And then just override default region#show, if view is
view.firstRender
is true it's not rendered yet and must render it, else no action required.Edit
The solution above works fine, another way is (this will assume that view is rendered) :
this is not recommend though, use region.show(myView) if you can. Since it's gonna close the previous view to clean up all the event listeners, etc...