My understanding is that when writing my own extensions to ui, Iuse
the destroy method to revert the root widget element to the state it
was in before _init().

So, I do that like this:

(function($) {
    $.widget("ui.myWidget", {

       _init: function() {
            // add some needed classes, bind events etc.
      },
      someOtherMethod(): function() {
           // do some other stuff
      },

      destroy: function() {
          // take off all classes I added in _init()
         // unbind events from this.element
         // do whatever else to revert element back to pre _init()
         return this;
      }
....etc...

So, I assume this is expected behavior in order to comply with UI API:

var node= $('#my-widget-node'); // get the root node once

node.myWidget(); // creates an instance of myWidget

node.myWidget('destroy'); // reverts node back to original node before
calling widget

node.myWidget(); // creates an instance of myWidget (again) on the
node

The problem is, that once I call destroy, I cannot create the widget
again. _init() never gets called. I assume the ui core code is
preventing me from calling init again, but I cannot figure out why or
where. I looked at ui.accordion and it works as expected. I looked at
its destroy method and it does nothing different than mine that I
could see, but then again I am not great at reading other people's
code.

Any ideas what I am doing wrong?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery UI" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/jquery-ui?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to