| Page 1 of 1 | [ 3 posts ] |
|
Hello,
I'm trying to render a tree (MediaTextTree) from a datasource and to make the nodes editable for the user by following the example on YUI-page: http://developer.yahoo.com/yui/examples ... _edit.html With use of this line of code: MediaTextTree.subscribe("dblClickEvent",MediaTextTree.onEventEditNode); it works fine, as expected. The tree is displayed within a "SimpleDialog"-Box. But after closing the "SimpleDialog"-Box and reopening something seems to be "broken". By Double-Clicking a node now nothing happens anymore (no inline-editor pops up). Again I close my "SimpleDialog"-Box and opening it for a third time. By Double-Clicking a node now this error occurs: Fehler: d.getEl() is null Quelldatei: http://yui.yahooapis.com/combo?2.9.0/bu ... son-min.js Zeile: 59 The same error occurs with these lines of code: MediaTextTree.subscribe("enterKeyPressed",function(node) { YAHOO.log("label=" + node.label, "info") ; node.editNode(); }); For me, unfortunately, it is not so clear where the problem is. Maybe there is someone who knows what this error message means? Thanks in advance, Thomas |
|
JavaScript has no destructors, this means that resources can be left over once you make things disappear. I don't really know what is it that you do when you 'close' the dialog box but, making the dialog box disappear does not destroy the tree it contains, does not free the memory it takes and does not remove the event listeners unless you explicitly do so since, as I said, JavaScript does not know about destructors.
If you wipe out the HTML corresponding to the tree, the TreeView object remains as well as the event listeners you might have set. The event fires, the underlying object (not visible but still there) responds and, when it tries to reach an HTML element (via getEl()) it does not find it. Always call the destroy method on objects soon to be wiped out. Otherwise, without having some actual code to run and see what's wrong, I'm afraid I can only guess. |
|
Thanks a lot for your prompt reply.
It describes the problem I was running in and now it sounds clear what was happening. I now create the dialog box and the tree only once and it seems to work now. I will keep your suggestion ("... call the destroy method...") in mind... |
| Page 1 of 1 | [ 3 posts ] |
| You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum |
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info
Powered by phpBB® Forum Software © phpBB Group