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 –