02-23-2016 12:32 PM
Hello,
I am trying to add new NodeSet to topology using the addNodeSet method. However I get "Cannot read property 'parentVertexSetID' of undefined" error. See this fiddle: NeXt nodeset - JSFiddle
What am I missing?
Solved! Go to Solution.
02-25-2016 05:47 PM
addNodeSet is a low level API, you missed second parameter as config, it should look like this:
topo.addNodeSet(topologyData.nodeSet[0],{})
I will update NeXt make the second parameter as optional.
Abu
02-25-2016 05:47 PM
addNodeSet is a low level API, you missed second parameter as config, it should look like this:
topo.addNodeSet(topologyData.nodeSet[0],{})
I will update NeXt make the second parameter as optional.
Abu
02-26-2016 09:19 AM
Thanks, I was able to figure it out by looking at the code.
I have a couple of questions. Is there a method for removing NodeSet from topology? I tried the removeNode method but couldn't make it work. What about adding node to existing NodeSet?
03-02-2016 04:54 PM
I made a demo, you can refer it. Add node to nodeSet could be a little bit tricky. We don't have that feature before.
http://jsfiddle.net/nextsupport/f2eehbhz/
Abu
03-03-2016 12:13 PM
Thanks Abu. Any change of implementing the add node to nodeSet method? I would like to be able to add new node to nodeSet without reloading the dataset.
03-03-2016 12:47 PM
In this demo(removeNode&insertNodetoNodeSet - JSFiddle) I implement a function called 'addNodeToNodeSet', you can use this function. I am not add that to framework yet.
function addNodeToNodeSet(topo, pid, nodeData) {
if (!topo || !pid || !nodeData) {
return;
}
var graph = topo.graph();
var nodeSet = topo.getNode(pid);
if (nodeSet) {
var vertexSet = nodeSet.model();
var vertex = graph._addVertex(nodeData);
vertexSet.addVertex(vertex);
graph.updateVertexSet(vertex);
if (!nodeSet.collapsed()) {
var animation = nodeSet.animation();
nodeSet.animation(false);
nodeSet.collapsed(true);
nodeSet.collapsed(false);
nodeSet.animation(animation);
}
}
}
Abu
03-06-2016 08:26 AM
Thanks Abu, I got it working.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide