Question

I need to prevent tree node anchor from navigating current page, but the anchors have to keep showing its link (no hash).

I tried to put return false when it sets up the listener:

...
listeners : {
    click : function (node) {
        /* some processes */

        return false;
    }
}
...

Seems it is useless, the anchors are still firing its href.

I can't do onClick injection for all nodes, because the nodes are loaded on demand.

Any idea's?

Was it helpful?

Solution

I can't do onClick injection for all nodes, because the nodes are loaded on demand.

Not necessarily, have you thought about doing this with a different approach, i.e.:

YOURTREEPANELCOMPONENT.on('click',function(currentnode, clickevent){
   // prevent href from being called and the page from loading
   clickevent.stopEvent();
   // what else to do when the node is clicked
});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top