Opened 14 years ago

Closed 14 years ago

#3633 closed bug (fixed)

init callback problem with ui widget factory

Reported by: timothee Owned by: Scott González
Priority: critical Milestone: 1.7
Component: ui.core Version: 1.6rc2
Keywords: Cc:
Blocked by: Blocking:


Currently if a callback option to a widget attempts to call a method of the widget itself AND the callback is fired from the _init method, the method call on the widget fails.

That is 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 ui.core.js, that's line 290: (!instance && !isMethodCall && $.data(this, name, new $[namespace][name](this, options)));

A proposed solution is to: 1) remove the _init method call from the widget constructor 2) update line 290 to this:

(!instance && !isMethodCall && $.data(this, name, new $[namespace][name](this, options))._init());

Refer to this thread for other information:

Change History (2)

comment:1 Changed 14 years ago by Scott González

Owner: set to scott.gonzalez
Priority: minorcritical
Status: newaccepted

comment:2 Changed 14 years ago by Scott González

Milestone: 1.next1.6
Resolution: fixed
Status: acceptedclosed

Fixed in r1668. Thanks timothee.

It's worth noting that if you invoke callbacks during init, that you should be careful to make sure you already have any necessary properties and state setup to handle anything a user can do through the widget's API.

Note: See TracTickets for help on using tickets.