Why does Ember.js lose the valueBinding when I use bootstrap datepicker? -
i noticing in application when use below code given formatted date in date picker widget when click search console shows empty strings. if remove didinsertelement
method lose datepicker popup databinding remains , console shows dates typed in.
in handlebars template
{{view app.datefield valuebinding="controller.startdate" classnames="startdate"}} {{view app.datefield valuebinding="controller.enddate" classnames="enddate"}} <button {{action "search" target='controller'}}>search</button>
in app
app.applicationcontroller = ember.arraycontroller.extend({ search: function() { console.log(this.get('startdate')); return console.log(this.get('enddate')); } }); app.datefield = ember.textfield.extend({ didinsertelement: function() { return this.$().datepicker(); } });
any ideas why lose databinding when set didinsertelement
?
versions: bootstrap-datepicker,
handlebars-1.0.0-rc.3 ember-1.0.0-rc.3 jquery 1.9.1
i think problem datepicker , ember both see value changing in different ways. take @ this:
app.datefield = ember.textfield.extend( didinsertelement: -> @.$().datepicker().on 'changedate', => @.$().trigger('change') )
when widget change event fires, if turn around , trigger change event on element, ember should register fact binding updated.
Comments
Post a Comment