[ 3 posts ]

Thomas Schmalz

  • Username: thomas_schmalz
  • Joined: Wed Nov 02, 2011 1:46 am
  • Posts: 3
  • Offline
  • Profile

editable tree node

Post Posted: Wed Nov 02, 2011 2:29 am
+0-
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

Satyam

YUI Contributor

  • Username: Satyam
  • Joined: Tue Dec 09, 2008 12:34 am
  • Posts: 2016
  • Location: Sitges, Spain
  • GitHub: Satyam
  • Gists: Satyam
  • IRC: DevaSatyam
  • YUI Developer
  • Offline
  • Profile

Re: editable tree node

Post Posted: Wed Nov 02, 2011 6:40 am
+0-
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.

Thomas Schmalz

  • Username: thomas_schmalz
  • Joined: Wed Nov 02, 2011 1:46 am
  • Posts: 3
  • Offline
  • Profile

Re: editable tree node

Post Posted: Wed Nov 02, 2011 7:52 am
+0-
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...
  [ 3 posts ]
Display posts from previous:  Sort by  
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