0

hi i am forming a complex tree structure using d3.js and html5 drag and Drop, however we were able to form the tree but when i click on the cloned D3 node(SVG) i want to trigger the ng-click associated with the angular element from which the d3 element is being formed.. this is what i was able to achieve as of now.. please see the code and picture for your refrence

function selectNode(d, i,type,$rootScope) {
var id = this.getAttribute("id");
document.getElementById(id)
$rootScope(id).isVisible=true;
switch (selectedNodes.length) {
case 0:
selectedNodes[0]= nodeMap[id];          
break;
case 1:
if (!d3.event.ctrlKey){
obj = selectedNodes.pop();              
obj.svg.setAttribute("style", "stroke-width:0");
selectedNodes[0]= nodeMap[id];
}else{
nodeMap[id].parent = selectedNodes[0];
selectedNodes[1]= nodeMap[id];
selectedNodes[0].children.push(selectedNodes[1]);
}
break;
case 2:
obj = selectedNodes.pop();
obj.svg.setAttribute("style", "stroke-width:0");
obj = selectedNodes.pop();
obj.svg.setAttribute("style", "stroke-width:0");
selectedNodes[0]= nodeMap[id];
break;
}   
this.setAttribute("style", "stroke-width:3;stroke:rgb(0,255,0)");
}
Raj_55
  • 3
  • 6
  • Possible duplicate of [How to select parent element of current element in d3.js](http://stackoverflow.com/questions/20641953/how-to-select-parent-element-of-current-element-in-d3-js) – Union find Mar 25 '17 at 13:19
  • i reffered the above question, but my question is to select the ID of the element from where the the SVG is being formed. – Raj_55 Mar 25 '17 at 14:00
  • 'd3.select(this.parentNode)' is selecting the SVG as its parent – Raj_55 Mar 25 '17 at 14:01

0 Answers0