Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In the vis javascript library, how do I get the node from its node Id?

So I create the nodes like this...

var nodes = new vis.DataSet([
    {id: 1, label: 'Peter'},
    {id: 2, label: 'John'},
    {id: 3, label: 'Sally'},
]);

then later on in an event handler after clicking on a node I get the id of the node i clicked. How do I get node object from its id?

like image 294
srayner Avatar asked Aug 06 '15 21:08

srayner


1 Answers

I actually found the documentation here; https://visjs.github.io/vis-data/data/dataset.html#Getting_Data

node = nodes.get(nodeId);
like image 50
srayner Avatar answered Sep 17 '22 08:09

srayner