How to subclass a specific jqueryui widget method ?

Posted by SBUJOLD on Stack Overflow See other posts from Stack Overflow or by SBUJOLD
Published on 2010-03-26T20:40:04Z Indexed on 2010/03/26 20:43 UTC
Read the original article Hit count: 341

Since I updated jQueryUI to 1.8 I found a couple of issues in our implementations and I could fix it myself without waiting for a fix on their end if I could find out how to subclass a specific method of the datepicker widget so I call the parent code and then execute my code.

I was reading on $.widget but I just can't wrap my head around how that is suppose to work.

I tried something like this:

$.widget("ui.datepicker", {
  _showDatepicker: function(input) {
   alert('Yo');
   $.datepicker.prototype._showDatepicker.apply(this,arguments);
   alert('Hey!');
  }
 });

And all sorts of other variations and beging to think I just don't understand the 'extendability' of jQueryUI or it just can't be done.

Anybody knows how I can achieve this ?

Thx

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery