Opened 10 years ago

Closed 10 years ago

Last modified 9 years ago

#9568 closed defect (fixed)

dijit.Tooltp doesn't work when is instantiated from inside of other widget template

Reported by: Aleksey Rechinskiy Owned by: bill
Priority: high Milestone: 1.4
Component: Dijit Version: 1.3.1
Keywords: Cc:
Blocked By: Blocking:

Description

Hi!

Please, take a look into attached test file.

It creates a new widget with dojo.declare(), based on [dijit._Widget, dijit._Templated], with widgetsInTemplate:true and templateString set to a string with dijit.layout.BorderContainer? widget inside. Inside of a second pane of BorderContainer? there is a dijit.Tooltip, that doesn't appears, while it must.

Run a page, click on the "resize" button (it is necessary to deal with #9567 ) and open a Pane 2 of BorderContainer?. Big text has a dijit.Tooltip attached, but it won't fire. The same HTML as templateString works as expected when is parsed on page load directly from a page.

This test case also demonstrates #9567 for BorderContainer?.

Attachments (1)

090718 tooltips.html (2.3 KB) - added by Aleksey Rechinskiy 10 years ago.

Download all attachments as: .zip

Change History (7)

Changed 10 years ago by Aleksey Rechinskiy

Attachment: 090718 tooltips.html added

comment:1 Changed 10 years ago by bill

Component: GeneralDijit
Milestone: tbdfuture
Owner: anonymous deleted

I assume this is still happening even after the fix to #9348 (on trunk).

This is an unusual case... probably the tooltip is created before your "wj" widget's DOM tree is added to the document (where the <div dojoType="wj"> used to be). So it's not surprising that the tooltip can't find the id="TMR_h1title" node.

An easy workaround is probably to call myTooltip.addTarget("TMR_h1title") inside of wj.startup(), rather than writing connectId="TMR_h1title" in the template.

Another alternative would be to make dijit.Tooltip do it's connections in startup() rather than postCreate(), but I don't want to change Tooltip to require startup() to be called.

comment:2 Changed 10 years ago by Aleksey Rechinskiy

Yes, you are right, it is still happening.

An easy workaround is probably to call myTooltip.addTarget("TMR_h1title") inside of wj.startup(), rather than writing connectId="TMR_h1title" in the template.

Well, yes, that is true. But the most tasty thing in templates is that they usually don't require any king of post creation processing :) It would be so convenient to instantiate nice looking tooltips directly from the widget's template ;))

comment:3 Changed 10 years ago by bill

Milestone: future1.4
Owner: set to bill
Status: newassigned

Fair enough, I think I can fix this w/a few lines of code that do connections in startup() iff it wasn't able to connect in postCreate(). Thus the startup() call will only be necessary in corner cases like this one.

comment:4 Changed 10 years ago by bill

Resolution: fixed
Status: assignedclosed

(In [19083]) Make Tooltips work correct when instantiated in templates. Fixes #9568 !strict.

comment:5 Changed 10 years ago by Aleksey Rechinskiy

Perfect! Thanks a lot! :)

comment:6 Changed 9 years ago by bill

(In [25500]) Fix bug in code from #9568, dealing with connecting to nodes that don't exist until the Tooltip.startup() call. This allows tooltip creation on Menus or in TitlePanes. Fixes #12665, refs #9568 !strict

Note: See TracTickets for help on using tickets.