1
votes

I am using Dynatree with select mode "3", which enables a hierarchical selection mode.

When my tree renders, all nodes that have children render as selected by default. Leaf nodes render unselected by default. If I start manually selecting nodes, the tree behaves as expected.

How can I force all nodes to be unchecked by default?

Notes:

  • Dynatree 1.2.1 RC3
  • Tree starts out empty and is programatically constructed using "addChild()"
  • It makes no difference if I explicitly add "selected: false" when building my nodes.
  • Have not tried pre-constructing the entire structure.

Thoughts?

2
sounds like a bug. the best would be to open an issue at googlecode and provide a samplemar10

2 Answers

0
votes

It turns out that the selection was occurring as a result of building my tree via code. When I call .addChild() to create a root level node the node is not selected. When I call .addChild() and add a child to it, it then becomes selected.

To fix this, I manually call .select(false) on the parent after adding the child.

I'm not sure if this is a bug in Dynatree or if I'm doing something wrong.

0
votes

You can try this

    $("#tree").dynatree("getRoot").visit(function(node) {
        node.expand(false);
    });

I know this solution is too late for you, but I am posting this so that it helps others who are facing the same issue.