jquery - Adding Custom Scripts to Ember -
so on app, loading in table rails db side, comes in late, , little $('tr:even').addclass("tralt"); - reads 1 tr, , doesn't apply css class styling. have placed script on didinsertelement follows:
app.recordsview = ember.view.extend({ templatename: 'records/index', contextbinding: 'app.recordcontroller', didinsertelement: function(){ $('tr:even').addclass("tralt") } });
but inital load 1 tr row (the headings), , ember isn't firing off view changes. of code same question.
consider using blockless form of {{each}}
, move jquery code didinsertelement of each row follows:
app.recordsview = ember.view.extend({ templatename: 'records/index', contextbinding: 'app.recordcontroller' }); app.recordrowview = ember.view.extend({ templatename: 'records/record', tagname: 'tr', didinsertelement: function(){ $('tr:even').addclass("tralt") } }); // in records/index.hbs {{each controller itemviewclass="app.recordrowview"}}
http://emberjs.com/api/classes/ember.handlebars.helpers.html#method_each
jquery ember.js
No comments:
Post a Comment