This has boggled me for some time, but I managed to keep pushing it forward. Unfortunately, the time has come I really need this.
My question is: Does EmberJS/Handlebars offer an event which gets called when a view is updated and visible in the DOM?
I need to use this event to run some jQuery stuff like addClass, sortable, etc. I've tried using the Live jQuery plugin but it doesn't work with Handlebars. On top of that I assume said event is already in place somewhere, I just can't seem find it.
Have you had a look at willInsertElement
, didInsertElement
, and willRerender
methods in Ember.View
? Also, there are plenty of post here on S.O. that deal with integrating jQuery plugins and frameworks with Ember.
https://github.com/emberjs/ember.js/blob/master/packages/ember-views/lib/views/view.js#L1250-1267
edit/update
After a little back and fourth in the comments, the final solution was to use Ember.run.next
. See: http://jsfiddle.net/ud3323/SsRuX/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With