Selected node in ST graph

73 views
Skip to first unread message

Rasmus Aveskogh

unread,
Nov 6, 2009, 7:56:51 PM11/6/09
to javascript-information...@googlegroups.com

Hi,

When altering style etc. in onBeforePlotNode how can I tell which node
that has focus right now? node.selected in ST gives me all nodes up to
the selected node..

-ra

venkatesh kavuluri

unread,
Nov 6, 2009, 10:55:32 PM11/6/09
to javascript-information...@googlegroups.com
node.selected works fine for me .. it returns a Boolean value which is true only for the node which is selected at that instant.

Venkatesh

Nico Garcia Belmonte

unread,
Nov 7, 2009, 5:17:46 AM11/7/09
to javascript-information...@googlegroups.com
I think that st.clickedNode == selectedNode.
--
I would never die for my beliefs because I might be wrong.

Bertrand Russell

Rasmus Aveskogh

unread,
Nov 7, 2009, 8:15:30 AM11/7/09
to javascript-information...@googlegroups.com

Thanks! That was what I was after..

I just want to be sure that the expected behaviour is that:

        onBeforePlotNode: function(node) {
            if (node == st.clickedNode) {
                node.data.$color = '#aaaadd';
            } else {
            delete node.data.$color;
            }

differs from:

        onBeforePlotNode: function(node) {
            if (node.selected) {
                node.data.$color = '#aaaadd';
            } else {
             delete node.data.$color;
            }

The latter will give all nodes in an ST-tree up to the selected node the color specified, whereas the former will only give the node that has focus right node the desired color.

Does this differ from your behavior Venkatesh?

-ra

venkatesh kavuluri

unread,
Nov 7, 2009, 5:07:42 PM11/7/09
to javascript-information...@googlegroups.com
You got the difference between node == st.clickedNode and node.selected right.

I was wrong in saying that node.selected gives true only for the selected node. Sorry about that, mia culpa.

- venkatesh
Reply all
Reply to author
Forward
0 new messages