This is fixed in r1668 and will be available in 1.6.  I added a
comment to the ticket, but it's worth noting here as well.

You should make sure you that you have all properties and states set
appropriately before invoking any callbacks on init.  By invoking a
callback, you're opening yourself up for a user to access any and all
parts of your widget API, not just one or two methods.  This shouldn't
be a problem if you invoke the callback at or near the bottom of your
init method.

On Nov 26 2008, 2:23 am, Timothee <timothee.grol...@muvee.com> wrote:
> Hi all,
>
> I'm using the ui.core framework to develop a few widgets for a site at
> the moment. I ran into the problem below. I'm developping with ui
> 1.5.2 but the problem still exists in SVN, as far as I can tell from
> the code.
>
> My widget constructor (method init) takes a callback function as one
> of its input options. The callback is fired from within the method
> init itself. The callback function (or any function called by it) then
> attempts to call one of the method of the widget via the call $
> ("query").mywidget("some_method").
>
> This fails (silently) because:
> 1) in the widget factory, the init method is ran from the constructor
> 2) the widget class instance is only added as dom data AFTER the
> constructor runs
>
> in SVN, that's line 290:
> (!instance && !isMethodCall &&
> $.data(this, name, new $[namespace][name](this, options)));
>
> In my case, the problem can be fixed by doing this:
> 1) remove the _init method call from the constructor
> 2) update line 290 to this:
>
> (!instance && !isMethodCall &&
> $.data(this, name, new $[namespace][name](this, options))._init());
>
> Thoughts?
>
> Tim.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery UI" group.
To post to this group, send email to jquery-ui@googlegroups.com
To unsubscribe from this group, send email to 
jquery-ui+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/jquery-ui?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to