Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I guess the problem lies in the fact that you where trying to listen on an event fired from the <strong>datetimepicker</strong> which is not captured, and thus the model value not set.</p> <p>To make things more solid you should get the <strong>datetimepicker</strong> current date value in your <code>doneEditing</code> function, just before saving the model back to the store.</p> <p>Let me show in code what I mean:</p> <pre><code>window.App.EventController = Ember.ObjectController.extend( ... doneEditing: -&gt; // relevant code line @get("model").set("date_begin", $('.datetimepicker').data('date')) @set "isEditing", false @get("store").commit() ... ) </code></pre> <p>And here your (working) <a href="http://jsfiddle.net/intuitivepixel/3QR6n/" rel="nofollow">jsfiddle</a>.</p> <p>Hope it helps</p> <p><strong>Edit</strong></p> <p>After reading your comment I've modified the input field inside your <strong>datetimepicker</strong> template. Please see <a href="http://jsfiddle.net/intuitivepixel/AmP4A/1/" rel="nofollow">here an updated jsfiddle</a> that also initializes the input field of the <strong>datetimepicker</strong> on edit begin when calling <code>edit</code>.</p> <pre><code>... edit: -&gt; @set "isEditing", true startDate = @get("model").get("date_begin") @$(".datetimepicker").data({date: startDate}).datetimepicker("update") ... </code></pre> <p>You are now safe to remove the <code>onDateChange</code> function and do init and save inside your <code>edit</code> and <code>doneEditing</code> respectively, applying format or whatever. </p> <p><strong>Edit 2</strong></p> <p>Reading your last comment, this is how you register <code>customEvents</code> for example in your <code>App.DateTimePickerView</code>:</p> <pre><code> ... customEvents: { changedate: "changeDate" } ... </code></pre> <p>this way Ember will be aware of your custom events. You can register whatever events you want but notice that the keyname is lowercased and the value must have the event name to listen to camelcased. For more infos on custom events see <a href="http://emberjs.com/guides/understanding-ember/the-view-layer/#toc_adding-new-events" rel="nofollow">here</a>.</p> <p>Please see here for another <a href="http://jsfiddle.net/intuitivepixel/AmP4A/2/" rel="nofollow">update jsfiddle</a> with the <code>changeDate</code> custom event registered.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload