Opened 11 years ago

Closed 11 years ago

Last modified 10 years ago

#7334 closed defect (wontfix)

StackContainer: does not call addChild for panes in markup

Reported by: dante Owned by: bill
Priority: high Milestone: tbd
Component: Dijit Version: 1.1.1
Keywords: Cc:
Blocked By: Blocking:

Description

If you are subclassing StackContainer, and your subclass relies on addChild notifying you about any and all children that pass through the StackContainer, you are forced to use a private method _setupChild.

this only happens in a random edge case somewhere between markup-only and programmatic instantiation, as startup() is called on the Tab by the parser, which calls _setupChild exclusively, or programatically adding the new panes via addChild.

solutions: make _setupChild public, and support the API: setupChild(widget) or have startup in TabContainer call addChild. The latter is safer.

Attachments (1)

tab-setTitle.html (1.6 KB) - added by dante 11 years ago.
test illustrating issue

Download all attachments as: .zip

Change History (4)

Changed 11 years ago by dante

Attachment: tab-setTitle.html added

test illustrating issue

comment:1 Changed 11 years ago by dante

to note: this came up as a user question about the Campus article: http://dojocampus.org/content/2008/06/06/hacking-tabcontainer-settitle-extension/

The example uses addChild, but changing it to _setupChild safely solves the issue in the testCase. The 'issue' is the underscore, ultimately.

comment:2 Changed 11 years ago by bill

Resolution: wontfix
Status: newclosed

Yah.. I think of _setupChild() as protected, not private. (I know we unfortunately have no way of denoting the difference; I'd like to add that to the doc at some point.)

I agree that addChild() not being called for the initial children is confusing, but seemed unavoidable (hence why we made the _setupChild() method in the first place). IIRC it was a performance issue, at least for widgets like BorderContainer.

Anyway, I understand the sentiment to make _setupChild() public but I don't want to do it, because then non-experts users might try call setupChild(), or try something like <div dojoType=TabContainer setupChild="alert(...)"> (since that works for onClick on a Button) but obviously wouldn't work here.

comment:3 Changed 11 years ago by dante

Fair enough ... I'll add this note to the StackContainer? and TabContainer? documentation.

Note: See TracTickets for help on using tickets.