A have a jsfiddle with a simple data structure that adds children to nodes when the node is clicked. I want it to look for existing children of the node clicked. Documentation shows node.children(); - to do this - but it is returning an empty list. Not sure what I'm doing wrong.
Below is a snippet of the where the children function is called.
The GetMoreData is called in the node click handler.
Any suggestions?
function GetMoreData(cy, event)
{
debugger;
var children = event.cyTarget.children();
var test = cy.nodes().children();
var parentID = event.cyTarget.data('id');
var nodeID = event.timeStamp.toFixed(0) + "x";
cy.add({group:"nodes", data: {id:nodeID, guid:nodeID, image:'https://circabc.europa.eu/images/extension/help.png'},
position:{x:event.cyPosition.x, y:event.cyPosition.y}});
var edgeID = parentID+"x"+nodeID;
cy.add({group:"edges", data: {id:edgeID, source:parentID, target:nodeID}});
var nodex = cy.elements('node[id="x"]');
var layout = cy.makeLayout({ name: 'breadthfirst', animate: true, animationDuration: 500, fit: false });
layout.run();
}