View Full Version : Tree click on icon and href

26 Feb 2009, 1:18 AM
Sorry for my english :

In a tree panel with :

leaf: true
,text: 'Google'
,href: 'http://www.google.fr'
,hrefTarget: '_blank'
when i click on the icon nothing happens, when i click on the text it works.
so i try to put a listener to make it working when i click on the icon
but i don't know how to do :((

,listeners: {
click: function(n,e) {
// determine that the click is on the icon and not on the text
// and use n.attributes.href to fire or relay an event ???
thanks for your help

26 Feb 2009, 2:02 AM
If you inspect the HTML of the treenode, you'll see that the "google" link does not include the tree node icon. You could write code that finds the images for links and adds the click handler that matches the link.

try something like this:

var tree = (get your tree component here.)
Ext.each(tree.el.query('a'), function(a){
// use some way of identifying your link. It could be that ALL your links have the 'http:' in the URL.
if(a.href.indexOf('http:') > -1){
var img = Ext.get(a.parentNode).query('img.x-tree-node-icon');

// check that there is an "img" found before working with it.
window.open(a.href, a.target)



26 Feb 2009, 2:17 AM
It works ! :D
thank you very much