Opened 13 years ago

Closed 12 years ago

Last modified 10 years ago

#1177 closed enhancement (fixed)

Node ID - widget ID linking

Reported by: andrei.neculau@… Owned by: tk
Priority: high Milestone: 0.9
Component: Widgets Version: 0.3
Keywords: Cc: andrei.neculau@…;, ktiedt@…
Blocked By: Blocking:


The DomWidget?, and even more specifically HtmlWidget? misses one important thing! Preserving the Node ID (the old node).

It is specifically useful for let's say the ToolTip? widget. If you give an id to a widget's plain element, then, when the widget is in place, it does not retain the plain element's id, therefore tooltip raises an error saying that it could not find the element with that id.

I have accomplished this by modifying DomWidget?'s postInitialize function, though maybe it more logical to modify HtmlWidget?'s postInitialize (line 399 for version 0.3.1). I have basically added the following line, after line 400: =;

Change History (8)

comment:1 Changed 13 years ago by dylan

Milestone: 0.4
Priority: highnormal

comment:2 Changed 13 years ago by andrei.neculau@…

Actually this could be interpreted as a rookie mistake.

What should get done is a template update. For instance the Button widget template should have id="${this.widgetId}" as attribute for the main tag (widget's domNode). The same for every other widgets... But since there are so many widgets that do not have an inner node that will take up the main tag's id, there should be a general solution, and then let the specific widgets erase the main tag's id, so that there won't be two elements with the same id.

comment:3 Changed 13 years ago by morris

Also not that using $ within templates prevents caching of the generated dom nodes by domwidget.js

comment:4 Changed 13 years ago by dylan

Owner: changed from bill to tk

comment:5 Changed 13 years ago by tk

Cc: andrei.neculau@… ktiedt@… added
Status: newassigned

I'm not sure I understand the problem here... It sounds like you want to be able to dojo.byId('id') to get your widget... but thats why gets copied to widgetId so dojo.widget.byId('id'); will return your widget...

or are you saying that the parentNode (used in this case to mean the outter most node of the Widget's template file) should have the id of the widget as well?

If the latter is the case, then this sounds like something that could be done in one of the core widget files, after the widget recieves its widgetId setting and has a valid domNode value...

I'll wait for some more feedback on this.


comment:6 Changed 13 years ago by dylan

Milestone: 0.40.5

comment:7 Changed 12 years ago by tk


Hopefully you can clarify this... as it stands, can you offer a better explanation or example of what you mean?

comment:8 Changed 12 years ago by bill

Resolution: fixed
Status: assignedclosed

id's should now be copied from the source markup to the template, usually to this.domNode although for checkbox (?) it goes to the focusNode. Please open another bug if a particular widget isn't copying the id.

Note: See TracTickets for help on using tickets.