ember-cli-bootstrap-datepicker icon indicating copy to clipboard operation
ember-cli-bootstrap-datepicker copied to clipboard

Two-way binding not working

Open yankeeinlondon opened this issue 10 years ago • 10 comments

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.

yankeeinlondon avatar Jan 05 '15 22:01 yankeeinlondon

Will check on that. Thank you for reporting this issue.

soulim avatar Jan 05 '15 22:01 soulim

Any update on this?

yankeeinlondon avatar Jan 13 '15 14:01 yankeeinlondon

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.

soulim avatar Jan 13 '15 14:01 soulim

I'm sorry for this huge delay. Just released v0.3.1 that fixes the issue with two-way binding.

soulim avatar Feb 17 '15 14:02 soulim

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.

timolehto avatar Feb 21 '15 16:02 timolehto

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.

soulim avatar Feb 21 '15 18:02 soulim

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. screen_capture 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).

timolehto avatar Feb 22 '15 10:02 timolehto

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);
  }

timolehto avatar Feb 22 '15 11:02 timolehto

I'm also seeing this issue, solution is what @timolehto mentioned above. Should we reopen this?

samselikoff avatar Mar 18 '16 19:03 samselikoff

@samselikoff thank you for a bug report. I'm reopening the issue then.

soulim avatar Mar 18 '16 21:03 soulim