I would like to use the approach described by Derick Bailey in the “ General Problem Solving ” section of this thread to display the view after the model is retrieved. I will communicate his solution here:
MyView = Backbone.View.extend({
initialize: function(){
this.model.on("sync", this.render, this);
},
render: function(){ ... }
});
myModel = new MyModel({id: someId});
new MyView({
model: myModel
});
myModel.fetch();
I have a slightly different situation: my view is inside the layout of the region. If I call Marionette.Region.show (), it works, but the view is displayed twice. The call to Marionette.Region.attachView () renders the view rendering function once, but the content does not appear on the page.
Any idea?
source
share