Skip to content

Missing Open Icon when adding new node #51

Open
@cclzxl

Description

Hello,

I would like to load child node when the parent node is clicked, because the size of tree is very large.

In the code below, I add a new child node "c" when clicking node "a", who has already a node named "b" and "b" has children as well.
When a is opened is selected, the open icon of "b" is disappared.

I'm working on Jupyter and chrome, ipytree version 0.2.1

from ipytree import Tree, Node

t = Tree(Stripes = True, multiple_selection=False)
a = Node("a")
t.add_node(a)
b = Node("b", [Node("f"), Node("g")])
b.opened = False
a.add_node(b)

def on_click_temp(event):
    if(event.name=="selected"):
        if (event["new"] == False)  and (event["old"] == True):
            return
    
    event["owner"].add_node(Node("c", [Node("d"), Node("e")]))

a.observe(on_click_temp, names=["selected"] )

t

image

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions