sridhars711 / dynatree

Automatically exported from code.google.com/p/dynatree
0 stars 0 forks source link

Tree doesn't seem to process children recursively #44

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Initialize the tree by running the attached script.

What is the expected output? What do you see instead?
I'd expect the tree to be populated with all children. Instead, the tree
contains data only until the "Department" level (e.g. the nodes with "John
Doe", "Joe Sixpack" and so on are not in the tree).

What version of the product are you using?
dynatree-0.3_beta_20080914

On what operating system and browser?
Windows, Firefox 2, IE 7, IE6, Opera 9.27 and Safari 3.1.2.

Original issue reported on code.google.com by business...@gmail.com on 20 Oct 2008 at 11:04

Attachments:

GoogleCodeExporter commented 9 years ago
I possibly found the bug in the code. In the initialization section, we can see 
the
following code:

// Init tree structure
if( opts.children ) {
// Read structure from node array
root.append(opts.children);
[...]

Which I interpret as "pass the list of children to the "Append" method. 
However, when
each node is processed, code is as follows:

[...]
if( data.children )
  for(var j=0; j<data.children.length; j++)
  dtnode.append(data.children[j]);
[...]

Which I read as "passing each single child to the Append method". I believe this
approach is wrong (it should be recursive), so I changed the code as follows;
[...]
if( data.children )
  dtnode.append(data.children);
[...]

Now everything seems to be working, but I'd like to wait for a confirmation 
before
bringing the code to production. Thanks.

Original comment by business...@gmail.com on 20 Oct 2008 at 12:01

GoogleCodeExporter commented 9 years ago
Hi,
I fixed this lately (see issue #41, r60), it's in the trunk but not in a new 
release
yet. 
Thank you anyway.

Original comment by moo...@wwwendt.de on 20 Oct 2008 at 6:44

GoogleCodeExporter commented 9 years ago

Original comment by moo...@wwwendt.de on 26 Jan 2013 at 4:08