I m using ExtJS 4 (beta 3) and I have a TreePanel that is my kind of navigation menu. It is something like this:
- Jobs
- Add Job
- List All Jobs
- ...
- ...
- ...
(this will be made on a permission system base, but that s another story)
On ExtJS 3, do something when i clicked "Add Job" was as simple as adding
...
leaf:true,
listeners:{
click:function(n){
//my code...
}
}
...
to the root children elements.
Now It s not that simple. The closer i got was with (on the treepanel)
listeners:{
click : {
element : el ,
fn : function(eve, elem, obj){
console.log(node);
console.log(elem);
console.log(obj);
}
}
}
So, maybe i m just a noob, maybe i have already a strong hatred for ExtJS, maybe is just a problem in this beta version, but...
How do I add a listener to the click event on the tree nodes? (the Select event won t do what i need)
Thank you guys.
EDIT: Currently testing with this, and it s not working.
... = Ext.create( Ext.tree.TreePanel , {
region : west ,
collapsible : false,
title : ITMI ,
width : 220,
margins : 5 5 5 5 ,
cmargins : 5 5 5 5 ,
hideHeaders : true,
useArrows : true,
rootVisible : false,
headers: [{
xtype : treeheader ,
text : Nome ,
flex : 1,
dataIndex: nome
}],
store: store,
listeners:{
itemclick: function(n){
console.info(n);
}
}
...
EDIT 2: The itemclick event now works (on EXJS 4 final), It still doesn t solve my problem. I d Like to call a specific function when i call each treenode. Before it was really easy. Now i can t figure it out.