Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>One more thing about jQuery UI's datepicker widget as a EmberJS Mixin. If you want to supply a callback function to handle the beforeShowDay event, you will raise this error:</p> <pre><code>Uncaught TypeError: Cannot read property '0' of undefined </code></pre> <p>even if your callback function (in your ember view) return an array, like it's specified in the jqueryui doc</p> <pre><code> beforeShowDay: function(date){ some code... return [true, '']; }; </code></pre> <p>This happens because nothing is returned after the callback.call in the _gatherEvents function</p> <pre><code> _gatherEvents: function(options) { var uiEvents = this.get('uiEvents') || [], self = this; uiEvents.forEach(function(event) { var callback = self[event]; if (callback) { // You can register a handler for a jQuery UI event by passing // it in along with the creation options. Update the options hash // to include any event callbacks. options[event] = function(event, ui) { callback.call(self, event, ui); }; } }); } </code></pre> <p>I fix this by adding a return statement before the callback.call.</p> <pre><code>_gatherEvents: function(options) { var uiEvents = this.get('uiEvents') || [], self = this; uiEvents.forEach(function(event) { var callback = self[event]; if (callback) { // You can register a handler for a jQuery UI event by passing // it in along with the creation options. Update the options hash // to include any event callbacks. options[event] = function(event, ui) { return callback.call(self, event, ui); }; } }); } </code></pre> <p>working example <a href="http://jsfiddle.net/thibault/qf3Yu/" rel="nofollow">http://jsfiddle.net/thibault/qf3Yu/</a></p>
    singulars
    1. This table or related slice is empty.
    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.
    2. VO
      singulars
      1. This table or related slice is empty.
    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