Opened 7 years ago

Closed 7 years ago

#3633 closed bug (fixed)

init callback problem with ui widget factory

Reported by: timothee Owned by: scott.gonzalez
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 7 years ago by scott.gonzalez

  • Milestone changed from TBD to
  • Owner set to scott.gonzalez
  • Priority changed from minor to critical
  • Status changed from new to accepted

comment:2 Changed 7 years ago by scott.gonzalez

  • Milestone changed from to 1.6
  • Resolution set to fixed
  • Status changed from accepted to closed

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.