Tree cleanup
Posted on November 23rd, 2008 by jane
Since one doesn't exist, I've started writing a tree clean up method. It's posted here, but not fully complete. Feel free to criticize/improve upon it.
Cheers.
Ext.tree.TreePanel.prototype.destroy = function()
{
this.purgeListeners();
this.rootNode.destroy();
this.selModel = null;
if (this.loader)
this.loader.purgeListeners();
Ext.dd.ScrollManager.unregister(this.el);
if (this.dropZone)
this.dropZone.unreg();
if (this.dragZone)
this.dragZone.unreg();
this.el.removeAllListeners();
this.el.remove();
};
Ext.tree.TreeNode.prototype.destroy = function()
{
var l = this.childNodes.length;
for (var i = 0; i < l; i++)
this.childNodes[i].destroy();
this.childNodes = null;
for (var i in this.attributes)
this.attributes[i] = null;
this.attributes = null;
this.purgeListeners();
if (this.ui.destroy)
this.ui.destroy();
};
Ext.tree.TreeNodeUI.prototype.destroy = function()
{
Ext.dd.Registry.unregister(this.elNode);
if (this.node.attributes.qtipCfg)
Ext.QuickTips.unregister(this.textNode);
Ext.destroy.apply(Ext, [this.textNode, this.anchor, this.ecNode, this.iconNode, this.el, this.checkbox]);
};