Skip to content

Instantly share code, notes, and snippets.

@alexanderbartels
Last active August 29, 2015 14:05
Show Gist options
  • Save alexanderbartels/5ea6ffdb91f5501e6687 to your computer and use it in GitHub Desktop.
Save alexanderbartels/5ea6ffdb91f5501e6687 to your computer and use it in GitHub Desktop.
overview of extending jQuery UI widgets in 1.8
(function($, _super){
$.widget('bartels.myDialog', $.ui.dialog, {
options: {
someKey: undefined
},
_create: function () {
_super._create.call(this);
this.updateSomeKey(this.options.someKey);
},
open: function () {
console.log("Open dialog");
return _super.open.apply(this, arguments);
},
updateSomeKey: function (value) {
console.log("Update someKey: ", value);
},
_setOption: function( key, value ) {
switch( key ) {
case "someKey":
this.updateSomeKey(someKey);
break;
}
_super._setOption.apply( this, arguments );
},
destroy: function() {
_super.destroy.call(this);
}
});
})(jQuery, jQuery.ui.dialog.prototype);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment