-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
Closed
Description
Hi,
I am using Vis Network with Vue.js and I created two very simple applications, but none of them is working properly.
1) The first app is here: https://jsfiddle.net/Filip_Z/9k2s3dgj/4/
The problem is that it cannot delete only the first node (with id=0). All of the other nodes can be deleted.
In the browser console there are no errors.
Vue.component('ovs-network', {
template: "#mytmp",
data() {
return {
network: null,
nodes: [
{ id: 0, label: '0' },
{ id: 1, label: '1' },
{ id: 2, label: '2' },
{ id: 3, label: '3' },
{ id: 4, label: '4' }
],
edges: [],
options: {
manipulation: {
enabled: true,
initiallyActive: true,
deleteNode: function (deleteData, callback) {
callback(deleteData)
}
}
},
container: ''
}
},
mounted() {
this.container = document.getElementById('mynetwork');
var data = {
nodes: this.nodes,
edges: this.edges
};
this.network = new vis.Network(this.container, data, this.options);
}
});
const app = new Vue({
el: '#app'
});
2) The second app is here: https://jsfiddle.net/Filip_Z/3ead4r51/1/
The problem is that after applying the setData
method, wrong labels are displayed. As you can see in the example, when you click on the button - this Vue method will be executed:
updateData() {
var nodes = [
{ id: 0, label: '0' },
{ id: 1, label: '1' },
{ id: 4, label: '4' }
];
this.network.setData({ nodes: nodes, edges: []});
console.log('Updated!');
this.disabled = true;
}
So there will be three nodes but, for some reason, all these nodes will have the same label: '4'.
In the browser console there are no errors.
Now, I'm not sure where the problem is (Vue or Vis).
Metadata
Metadata
Assignees
Labels
No labels