I'm currently migrating some code from 1.8 to 1.9.2 and I'm facing the situation where widgets are destroyed before being initialized. For example, the following can be faulty (throwing an exception) now in 1.9.2 : is there any way I can check the call is possible :
$div.buttonset("destroy")
You can check for widget's existence using $element.data("widget-name") then call what you want.
The proper name of the widget is namespace + dash + plugin name. For ex.: ui-tabs, ui-dialog etc.
In my project I have a widget with full name mediaITPro.player. The right name to pass to data call is "mediaITPro-player".
The following line does the job for me:
if (p.data("mediaITPro-player")) p.player("destroy");
I hope this helps.
P.S. The docs on naming conventions for .data call http://jqueryui.com/upgrade-guide/1.9/#changed-naming-convention-for-data-keys
At least for dialog widget you can use div.is(":ui-dialog")
. Note that with JQuery UI 1.10.1 the old if (div.data("dialog"))
does not work (at least for me).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With