开发者

Prevent ExtJS Tree Node anchor from firing, but no hash

I need to prevent tree node anchor from navigating current page开发者_StackOverflow社区, 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?


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
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜