Hi there,
for my nodes I have a TreeExpanderButton which works fine. Now I would like to add a TreeExpander/Collapsed Listener and obtain a reference to the key of the node that I just clicked on. How do I do that?
Here’s what I would like a Listener to look like:
myDiagram.addDiagramListener("TreeExpanded",
function(e) {
// Some code I can't figure out that gets me node_key
console.log("you just expanded node " + node_key);
});
I want something similar to this code sample on this page http://gojs.net/latest/intro/events.html, but it appears that “part” refers to the expander button, not to the node.
<pre -="" id="diagrams" ="" style="border: 1px solid rgb204, 204, 204; padding: 0.5em; color: rgb51, 51, 51; : rgb248, 248, 255; line-height: normal;"> diagram.addDiagramListener(<span ="" style="color: rgb196, 26, 22;">"ObjectSingleClicked"</span>,
<span ="keyword" style="color: rgb170, 13, 145;">function</span>(e) {
<span ="keyword" style="color: rgb170, 13, 145;">var</span> part = e.subject.part;
<span ="keyword" style="color: rgb170, 13, 145;">if</span> (!(part <span ="keyword" style="color: rgb170, 13, 145;">instanceof</span> go.Link)) showMessage(<span ="" style="color: rgb196, 26, 22;">"Clicked on "</span> + part.data.key);
});</pre>
Thank you very much!