Quantcast
Viewing all articles
Browse latest Browse all 4826

Ember-pikaday does not update selected date

@belgoros wrote:

I’m trying to get work ember-pikaday, add-on (version 2.2.4) and without success.

Here is its use in a template component:

#templates/components/holiday-hour.hbs

  <div class="col-sm-2">
    {{pikaday-input value=holidayDate class='form-control' onSelection=(action (mut holidayDate)) readonly="readonly" format="DD/MM/YYYY"}}
  </div>

Here is the CP holidayDate in the component:

#components/holiday-hour.js

export default Component.extend({
  i18n: service(),
  constants: service(),
  holiday: null,
  state: null,
  states: [],
  tagName: '',
  currentLanguage: '',
  shouldDisplayDeleteIcon: false,
....

  holidayDate: computed(function() {
    return this.get('holiday').get('date');
  }),
...

Here is how I call the component template:

#templates/holiday-hours.hbs

<form {{action "updateHolidayHours" on="submit"}}>
      {{#each model as |holidayHour|}}
        {{holiday-hour holiday=holidayHour shouldDisplayDeleteIcon=true deleteAction=(route-action 'deleteHoliday' holidayHour)}}
      {{/each}}
...

What is wrong with syntax to be able update the holiday date ? When checking the date value of the holiday-hour component in the Inspector, - the date has a correct new value. When submitting the form in updateHolidayHours of the router, the holiday-hour model has always the initial date value :(. Thank you.

Posts: 3

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4826

Trending Articles