Open
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
Metadata
Assignees
Labels
No labels