Reputation: 11629
I see this example at http://visjs.org/examples/network/events/interactionEvents.html.
I want to set up a onclick handler and I want to extract the title of the node (not limited to the ID such as 1, 2 and so on). I couldn't find a good example and I am wondering if anyone knows how?
Cheers, K
Upvotes: 0
Views: 1625
Reputation: 163
You might want to look at the following parts of the documentation:
select
event: http://visjs.org/docs/network/#EventsdataSet.get()
: http://visjs.org/docs/data/dataset.network.on('select', function(selection){ let selectedNodeIds = selection.nodes; // array of selected node's ids let selectedNodes = nodes.get(selectedNodeIds); // retrive node objects from dataSet object let selectedNodesLabels = []; for( let i in selectedNodes ) { selectedNodesLabels.push(selectedNodes[i].label); } });
Upvotes: 1