Search code examples
javascriptthejit

Retrieve label HTML from node


I have a node of a SpaceTree graph (from the JIT library) and I'd like to modify the HTML of its label in a click listener. This would be trivial if I had a reference to the label object that is passed as a parameter to the onPlaceLabel() and onCreateLabel() functions, but I cannot find a way to get a reference. Is there an easy way of obtaining that reference from a node object?


Solution

  • I figured it out. You can get the the label of a node using

    st.labels.getLabel(node.id)
    

    Assuming st is the SpaceTree object and node is the node for which to get the label.