Author: nbelaevski
Date: 2008-01-23 20:32:41 -0500 (Wed, 23 Jan 2008)
New Revision: 5575
Modified:
branches/3.1.x/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree-item.js
branches/3.1.x/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree-selection.js
branches/3.1.x/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree.js
Log:
http://jira.jboss.com/jira/browse/RF-2017
Modified:
branches/3.1.x/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree-item.js
===================================================================
---
branches/3.1.x/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree-item.js 2008-01-24
01:29:35 UTC (rev 5574)
+++
branches/3.1.x/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree-item.js 2008-01-24
01:32:41 UTC (rev 5575)
@@ -36,7 +36,7 @@
},
destroy: function() {
- if (this == this.tree.selectionManager.activeItem) {
+ if (this.tree.selectionManager && this ==
this.tree.selectionManager.activeItem) {
this.tree.selectionManager.activeItem = null;
}
Modified:
branches/3.1.x/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree-selection.js
===================================================================
---
branches/3.1.x/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree-selection.js 2008-01-24
01:29:35 UTC (rev 5574)
+++
branches/3.1.x/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree-selection.js 2008-01-24
01:32:41 UTC (rev 5575)
@@ -13,6 +13,14 @@
Event.observe(this.tree.element, "click", this.eventPreventLostFocus);
},
+ destroy: function() {
+ this.activeItem = null;
+ this.tree = null;
+
+ Event.stopObserving(document, "keypress", this.eventKeyPress);
+ Event.stopObserving(document, "click", this.eventLostFocus);
+ },
+
restoreSelection: function() {
if (this.tree.input.value)
{
Modified:
branches/3.1.x/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree.js
===================================================================
---
branches/3.1.x/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree.js 2008-01-24
01:29:35 UTC (rev 5574)
+++
branches/3.1.x/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree.js 2008-01-24
01:32:41 UTC (rev 5575)
@@ -20,6 +20,8 @@
Tree.prototype = {
initialize: function(id, input, switchType, events, onAjaxSelect, toggleOnClick,
showConnectingLines) {
+ this["rich:destructor"] = "destroy";
+
this.childs = [];
this.elements = {};
@@ -30,6 +32,8 @@
this.oncollapse = new Function('event', (events.oncollapse ? events.oncollapse
: "") + "; return true;");
this.onAjaxSelect = onAjaxSelect;
this.element = $(id);
+ this.element.component = this;
+
this.inputId = input;
this.input = $(this.inputId);
this.toggleOnClick = toggleOnClick;
@@ -40,7 +44,6 @@
}, arguments[1] || {}
);
this.options = options;
-
//var d = new Date();
this.getElements();
//alert(new Date().getTime() - d.getTime());
@@ -108,6 +111,13 @@
}.bindAsEventListener(this));
},
+ destroy: function() {
+ this.selectionManager.destroy();
+
+ this.element.component = null;
+ this.element = null;
+ },
+
getElements: function(ajaxUpdate) {
this.elements.contentTd = $(this.id +
Tree.ID_DEVIDER + Tree.ID_CHILDS_ROW/* + Tree.ID_DEVIDER + Tree.ID_CHILDS_TD*/);