ember-cli-bootstrap-datepicker
ember-cli-bootstrap-datepicker copied to clipboard
Two-way binding not working
Choosing a date on the calendar does change the component's value
property but changing the value property through an Ember set()
-- which also updates the property as expected -- does not update the UI.
I have only tested this on the inline version of the component.
Will check on that. Thank you for reporting this issue.
Any update on this?
I'm a bit busy with my work last days. The fix is ready, but I didn't have a chance to test it properly.
I'm sorry for this huge delay. Just released v0.3.1 that fixes the issue with two-way binding.
Hey, are you sure this fixed? I have 0.3.1 and I see the date is properly set to the initial value and changes if I change the bound value externally from the component, but only on the input field. The calendar widget does not reflect these changes and when you open it up it looks like no date is selected.
Hmmm... Maybe I should double check that. Strictly speaking two-way binding didn't exist before 0.3.1, and any value changes didn't change anything on input field or calendar.
I'm not personally so concerned about the two-way binding its self, but I need to be able to give it an initial default value. Now the initial value of the bound property is set on the input field, but it's not marked active on the calendar. But I suppose the solution is to fix the binding, though my specific case could be solved by introducing another property just for the initial value. Here's a screen capture to further elaborate the issue.
P.S. Curiously, I just realised that pressing any key on keyboard while the calendar is open will make the active date appear (realised this as I was taking this screen capture on my mac with the cmd+shift+3 shortcut).
Inspired by my key release discovery I managed to patch this by doing this in my own wrapping component, maybe this helps you patch this entire thing.:
didInsertElement: function() {
var e = Ember.$.Event("keyup");
e.which = e.keyCode = 16; /*shift*/
this.$('input').trigger(e);
}
I'm also seeing this issue, solution is what @timolehto mentioned above. Should we reopen this?
@samselikoff thank you for a bug report. I'm reopening the issue then.