0
选择节点时,我想在节点上添加图标,并在图标上单击我想给出选项以编辑或删除选定节点。这可能或如何在Vis js中实现?vis js网络中的交互式节点
选择节点时,我想在节点上添加图标,并在图标上单击我想给出选项以编辑或删除选定节点。这可能或如何在Vis js中实现?vis js网络中的交互式节点
您可以使用click事件或nodeSelected。 这样的:
network.on('click', function (properties) {
selection = properties.nodes
if (selection > 0) {
var node_sel = nodes.get([selection])[0];
if(node_sel['selected']){
alert('add you buttons');
}
else{
alert('change the style here');
node_sel['selected'] = true;
node_sel['shape'] = 'box';
nodes.update(node_sel);
var msg = JSON.stringify(nodes.get([selection]))
alert(msg);
}
}
});
看到这个plunker,而不是提醒把你的代码。
更新了plunker链接 – TERMIN
http://visjs.org/examples/network/other/manipulationEditEdgeNoDrag.html –