javascript - Backbone.marionette: jQuery document.ready not running on route -


so have web application routes login button dashboard run initialize() function, contains document.ready() block. problem is, on backbone route seems document.ready() block isn't being run. here code clearify:

here's event landing page view:

events:     'click .pure-menu .signin':        () ->         application.router.navigate('dash', {trigger: true}) 

that routes application dashboard view:

module.exports = class dashview extends backbone.marionette.itemview     id: 'dash-view'     template: template      initialize: ->          $ ->             $(".gridster ul").gridster(                 widget_margins: [10, 10]                 widget_base_dimensions: [140, 140]             ) 

where have jquery document.ready() block code run once dom loaded.

i'm using gridster library, when page routes code not run, because gridster grids don't initialized.

when refresh page every thing works expected.

my guess when page routes, jquery doesn't "dom loaded" event, therefore block doesn't executed? i'm not sure. appreciated.

and solve using hack, know how route in backbone page refresh?

i think should add code in ondomrefresh method instead of initialize.

initialize called view created , view's element not placed in dom @ time, while ondomrefresh gets triggered after view has been rendered, has been shown in dom or has been re-rendered, may suit better needs.

you can check out in docs: marionette's view


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -