javascript - How to call destroy on disabled jquery widget? -
used libraries: jquery-ui-1.9.1 , jquery-1.8.2
i have 1 widget function called destroy
$.widget("my.customwidget", { options: { }, _destroy: function () { var self = this; this._super(); //some usefull functionality }, //some other declarations }); if widget disabled, due code in jquery-ui destroy method not called (code jquery-ui):
function handlerproxy() { // allow widgets customize disabled handling // - disabled array instead of boolean // - disabled class method disabling individual parts if ( instance.options.disabled === true || $( ).hasclass( "ui-state-disabled" ) ) { return; } return ( typeof handler === "string" ? instance[ handler ] : handler ) .apply( instance, arguments ); } this handleproxy inside of _on function. callstack looks so: when element widget removed, $.cleandata called. cleandata calls $( elem ).triggerhandler( "remove" )and trigger calls _on remove event. remove calls $.widget.destroy
how can make call destroy function on disabled widget?
update: created jsfiddle demonstration http://jsfiddle.net/9yygj1wm/
update: fixed in jquery-ui-1.9.2, how can fixed without upgrading of library?
hi dont know indepth flow, per brute force found solve issue
$("#destroywidget").click(function () { $("a").simplewidget("enable"); $("a").remove(); }); use temporary, experts explain :)
Comments
Post a Comment