Reputation: 21025
The problem is that the doc.ready fires before handlebar finish generating the inputs jquery ui needs to set the date picker on.
Is there a better event?
Upvotes: 0
Views: 511
Reputation: 2388
Here's some code that I used for jQuery Data Picker with my SC2 demo app (Chililog)
App.MyField = App.TextBoxView.extend(App.CriteriaFieldDataMixin, {
valueBinding: 'App.pageController.fromDate',
name: 'fromDate',
placeholder: 'yyyy-mm-dd',
disabledBinding: SC.Binding.from('App.pageController.isSearching').oneWay().bool(),
/**
* Attach date picker to text box
*/
didInsertElement: function() {
this._super();
this.$().datepicker({ dateFormat: 'yy-mm-dd' });
}
})
Use the didInsertElement
event to attach the datepicker. This event fires after the DOM element has been inserted.
Upvotes: 2