Opened 14 years ago

Closed 14 years ago

Last modified 13 years ago

#228 closed defect (wontfix)

HtmlWidget.destroyWidget() not implemented by most widgets

Reported by: jkuhnert@… Owned by: anonymous
Priority: low Milestone:
Component: Widgets Version:
Keywords: Cc:
Blocked By: Blocking:

Description

In many cases it is desirable to destroy a widget when completely replacing it. (Could be me doing something wrong here as well).

I've noticed that HtmlContainer? and others don't implement destroyWidget and hence the HtmlWidget? call doesn't destroy the child widgets of the container. Very specifically I've run across this using the FisheyeList?. When re-parsing the widget it gets Widget ID collision debug errors because the ids are still hanging around in Manager.

Change History (6)

comment:1 Changed 14 years ago by jkuhnert@…

Resolution: invalid
Status: newclosed

nevermind...saw argument

comment:2 Changed 14 years ago by anonymous

Resolution: invalid
Status: closedreopened

comment:3 Changed 14 years ago by jkuhnert@…

The dojo.widget.Manager remove/destroy functions comment on saying that the parent widget will have already destroyed it's own children and so it doesn't need to do it, but no one anywhere is actually doing this. The methods are there but commented out. This is probably known behaviour but I thought I'd post about it because the widgetIds[] and state of widgets on the client are starting to mess with my head a little ;)

comment:4 Changed 14 years ago by info@…

I get the same behaviour in Tree.

Given the following in a web page:

<div id="container">

<div dojoType="Tree" publishSelectionTopic="treeSelected" toggle="fade" widgetId="tagtree"> <div dojoType="TreeNode?" title="Regionss - 70" widgetId="70"></div> <div dojoType="TreeNode?" title="Regions - 64235" widgetId="64235"></div> </div>

</div>

I use dojo.io.bind to call in new tree code that I parse with like so:


var tree = dojo.widget.manager.getWidgetById('tagtree') if (tree) { tree.destroy(); }

var parser = new dojo.xml.Parse(); var frag = parser.parseElement(document.getElementById("container"), null, true); dojo.widget.getParser().createComponents(frag);


This works great, except if the new tree contains some of the old widgetId(s) than I get collision warnings from dojo debug like so:

DEBUG: widget ID collision on ID: 64235

The reason some of the widgetId(s) might be the same is that the ID is coming from a database and the number points to the primary key. Each ID is unique in the tree, but there are multiple trees.

Shouldn't these old TreeNode?(s) have been cleaned up or destroyed? I shouldn't be getting any collision warnings on ID.

comment:5 Changed 14 years ago by jkuhnert@…

Resolution: wontfix
Status: reopenedclosed

This is being handled by a more general consensus to have a more consistent api in a future release.

comment:6 Changed 13 years ago by (none)

Milestone: 0.3release

Milestone 0.3release deleted

Note: See TracTickets for help on using tickets.