I'm wanting to cache ItemView html with one (or potentially its own) region in Marionette.
The process is staged in different views with different forms. On visiting the each stage we want to append show the certain ItemView but we also want to be able to re-visit any previous views and it's html to change the form data and continue by updating subsequent views.
Here I have just added the view to the region on routing call.
buildView: function (page) {
try {
var view = new View[page]();
} catch (error) {
console.debug('This View Doesn\'t Exsist --> [' + page + ']', error);
}
Layout.body.show(view, { preventDestroy: true });
}
I am able to keep the previous view using different regions for each ItemView..
buildView: function (page) {
var _region = Layout[page], _view;
if (_region.hasView()) {
_region.show(_region.currentView);
} else {
try {
_view = new View[page]();
} catch (error) {
console.debug('This View Doesn\'t Exsist --> [' + page + ']', error);
}
_region.show(_view, {preventDestroy: true});
}
}
Does anyone know a good solution for this type of usage and showing previous ItemView's whilst being able to update the new view if necessary?
Should we just revert back to hiding and showing each region when needed and let this store our rendered html?
Happy to provide more information if anyone is not sure what i'm trying to explain here!
Thanks, sorry for rough and potentially not very insightful Q ^^.