Announcement

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

    Tree setRoot() method correct usage

    Hello Isomorphic!
    According to Tree setRoot() method javadoc, "If you're using the "parent" modelType, you can provide the root node configuration via this property."
    I need to construct a tree in parent mode, but adding children one by one.
    So, first of all I set the root using
    Code:
    setRoot(TreeNode root)
    then I add children using
    Code:
    tree.add(child, parent, position).
    When system renders the gui, the tree has not the specified node as root, but the first child added.
    Filtering too does not work, excluding the root node, see the attachment.
    If I want to have the specific node as root, I have to invoke
    Code:
    tree.setData(new TreeNode[]{p1});
    and then adding the children.
    Is this the expected behaviour of setRoot() method? Am I wrong or misunderstanding the api?

    Thanks in advance for the answer.

    PS: invoking setShowRoot() on both Tree and TreeGrid visually fixes "the problem", but filtering still returns 2 nodes rather than 3 as expected, the excluded node is the root. The second approach allows correct filtering, it returns 3 nodes.
    Attached Files

    #2
    Hello Isomorphic, any information?

    Comment

    Working...
    X