javascript - Switching from a region to another in Marionette, views are not rendered correctly -


i'm working marionette , have following problem.

i've created layout 2 different regions. on initialize layout loads 2 views in 2 regions of layout. viewa , viewb. within viewa event triggered. event consumed layout switch , other 2 views injected. viewc , viewd. whenever switching performed, viewc , viewd not have same style (also css) applied them. in particular, jquery mobile styles not applied. advice?

here code comments highlight important parts.

onconfirm : function() {                 this.leftview =  new viewc();         this.rightview = new viewd();          this.leftregion.show(this.leftview);                                                                                 this.rightregion.show(this.rightview);          // fix calling trigger('create') seems fix problem. why? correct?         this.$el.trigger('create');     },  initialize : function() {         // listen event triggered viewa         // e.g. gloabalaggregator.vent.trigger("ga:confirm");         // "ga:confirm" simple string         gloabalaggregator.vent.on("ga:confirm" , this.onconfirm, this);            this.leftview =  new viewa(), // creating here new viewc style applied correctly         this.rightview = new viewb(); // creating here new viewd style applied correctly     },  onrender : function () {         this.leftregion.show(this.leftview);                                                                                 this.rightregion.show(this.rightview);     } 

edit

calling trigger('create') seems fix problem. why? correct?

when add new html page (add new rendered view, swap view other view, etc..), have let jquery mobile know this.

"create" event used enhance "raw" html jquery mobile widgets. more info can found here: http://jquerymobile.com/demos/1.0/docs/pages/page-scripting.html "enhancing new markup" section.


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -