Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    What causes tree.linkNodes() to set parentId to null, a bug?

    Is this a bug in handling addition of treeNodes to the tree?

    I am building TreeNode[] treeNodes in a loop, setting parent ids for each node with treeNode.setParentId("123"). The parent node (123) is added to the tree earlier programatically.

    Than, after treeGrid.getData().linkNodes(treeNodes) is executed, all treeNodes end up with parentId attribute set to null.

    Using a debugger I step through code, I break right before linkNodes() and treeNodes[0].getAttribute("parentId") is showing to be set to "123". I execute the linkNodes() and debugger is showing that treeNodes[0].getAttribute("parentId") is now null.

    I tried adding original parent node to the TreeGrid using various methods none of which affect the end result but I guess that should be irrelevant anyway. Those methods are:
    1. create single row TreeNode[] array and add using treeGird.getTree().linkNodes(singleParentNodeArray)
    2. treeGrid.getTree().add(parentTreeNode, "/");
    3. treeGird.addData(parentTreeNode);

    I tried setting parent id with setParentId() as well as setAttribute("parentId") also didn't help.

    Here is what works - when I drop a parent node using mouse drag and drop and execute the same code that retrieves all children and sets all their parentIds to the id of the dropped node. In this case, I am setting the parent node programatically but execute the exact same code to get its children - that is the only real difference.

    Thanks,
    Henry

    #2
    bump.

    Really need some guidance here. I tried many different work-arounds and nothing helps. I really need to understand what condition causes TreeNode[] being fed into linkNodes() to get their parentId reset to null.

    thanks.

    Comment

    Working...
    X