2
votes

How we can track the status of view render in backbone marionette.

for example view need to fetch some data from server to render it.

App.main.currentView.ChatContactRegion.show(new ChatContactsView()); 

Here how I can check, whether view rendered successfully to given region? Is there any callback for show function?

Thanks Peter

1
not enough information to understand what you want to do, or why. please update the question with more detail.Derick Bailey

1 Answers

3
votes

A region manager will raise a few events during it's showing and closing of views:

So, in your example, the ChatContactsView instance passed to show() will have an onShow event triggered.

You can hook into that event in your ChatContactsView class definition:

ChatContactsView = Marionette.ItemView.extend({
  onShow: function(){
    // called when the view has been shown
  }
});

More detail in the docs