Opened 12 years ago

Closed 12 years ago

#4150 closed defect (fixed)

programmatic widget creation (lazy widget creation) impossible

Reported by: bill Owned by: bill
Priority: high Milestone: 1.0
Component: Dijit Version: 0.9
Keywords: Cc: Dustin Machi
Blocked By: Blocking:

Description

Typical case is creating a TabContainer? (either in markup or programmatically) and then later on creating a widget programmatically and adding it to the TabContainer?. Since the TabContainer? is already started (ie, startup() has already been called), nobody calls startup() on the child widget. Ouch.

Maybe if the parent is already started then addChild() should call startup on the child, if the child isn't started already. Or resize() should call startup() if the widget hasn't been started already.

Change History (1)

comment:1 Changed 12 years ago by bill

Resolution: fixed
Status: newclosed

(In [10245]) Fixes #4150: adding programmatically created layout widgets to existing (and started) layout widgets broken.

Call child.startup() in addChild(), if child isn't already started.

Child.startup() needs to be called after child is connected to the dom tree (in particular, layout widgets need to query to see if their parent is a layout widget), but before parent.addChild() calls child.resize()... so it really needs to happen in the middle of parent.addChild().

Note: See TracTickets for help on using tickets.