0

refer to the HyperTree in this link

How can I add an event to handle click events of edges?

Thanks.

Erenor Paz
  • 3,061
  • 4
  • 37
  • 44
hosir
  • 477
  • 1
  • 9
  • 33

1 Answers1

0

What about this:

//Attach event handlers and add text to the  
//labels. This method is only triggered on label  
//creation  
onCreateLabel: function(domElement, node){  
    domElement.innerHTML = node.name;  
    $jit.util.addEvent(domElement, 'click', function () {  
        ht.onClick(node.id, {  
            onComplete: function() {  
                ht.controller.onComplete();  
            }  
        });  
    });  
},  

You can find this code in this link, under the section "Hypertree", and that's the code that manages clicks on nodes. Is that what you wanted to know?

EDIT:

The problem seems toreside in the type of "edge". Changing it from "hyperline" to "line", as suggested in this question, may do the trick, allow the binding of a click event.

Community
  • 1
  • 1
Erenor Paz
  • 3,061
  • 4
  • 37
  • 44
  • I want to have an event on handling click on the edge, any idea on that? – hosir May 29 '13 at 01:59
  • Did you try using the piece of code in my qnswer, and using "edge" instead of "node", to add an onClick event? – Erenor Paz May 29 '13 at 13:09
  • Yes, "edge" mean line, not node. I have tried using "edge" instead of "node" in the code, but still no response when clicking the edge. – hosir May 30 '13 at 03:14
  • Here on SO i found [this question](http://stackoverflow.com/questions/16547214/infovis-jit-add-click-listener-to-edge) where he says that the onCLick event on the edges with type "hyperline" is not yet implemented. However, you could change the type of the edge to "line" to be able to use the click event. I'll add that to the answer, for completeness – Erenor Paz May 30 '13 at 10:15