How create nested nodes + selectNode event is executed after the node loses the focus
merlincita opened this issue · 1 comments
merlincita commented
Hello,
I am new using this library. I have a couple of questions:
- I want to change the background color of a node when it is clicked. What is happening is when clicking the node, it changes its layout to the default config, and after the node loses the focus is when its color changed. Please see the code below. I also try the click event and got the same behavior.
vm.networkEvents = { selectNode: function (selected) { var nodeID = selected['nodes']['0']; if (nodeID) { var clickedNode = nodes.get(nodeID); clickedNode.color = { background: 'yellow' } nodes.update(clickedNode); } } }
The other question is I am trying to draw some nodes inside a container node, something similar to the attached image. I create a node with shape: 'box', shapeProperties: { borderDashes: true } to draw the container, and the other nodes with shape: 'database'. How can I embedded/nested these database nodes in the container node?
Thank you!
cdjackson commented
Please consider looking at the vis documentation. This library is a relatively thin wrapper over the main library.
… On 19 Apr 2017, at 22:22, Merlin ***@***.***> wrote:
Hello,
I am new using this library. I have a couple of questions:
I want to change the background color of a node when it is clicked. What is happening is when clicking the node, it changes its layout to the default config, and after the node loses the focus is when its color changed. Please see the code below. I also try the click event and got the same behavior.
vm.networkEvents = { selectNode: function (selected) { var nodeID = selected['nodes']['0']; if (nodeID) { var clickedNode = nodes.get(nodeID); clickedNode.color = { background: 'yellow' } nodes.update(clickedNode); } } }
The other question is I am trying to draw some nodes inside a container node, something similar to the attached image. I create a node with shape: 'box', shapeProperties: { borderDashes: true } to draw the container, and the other nodes with shape: 'database'. How can I embedded/nested these database nodes in the container node?
<https://cloud.githubusercontent.com/assets/1311742/25200092/5d3b6e68-250a-11e7-841e-d83ac22c1792.PNG>
Thank you!
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub <#73>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AA_kQxQ98t4wQ8RzV_jZXw8l66ufRhbRks5rxm0VgaJpZM4NCMfJ>.