PDA

View Full Version : Treepanel Listener event does not works ExtJs 4.0.7



icebergdelphi
29 Nov 2011, 4:24 PM
Hi All, i need to fire a event in my treepanel node , but anything happens,i'm using this code:
listeners:{
itemclick:{

fn: function(){
Ext.Msg.alert('ExtJs is So Cool');
}
},

check this out, the rest of my code:



items: [
{
xtype: 'treepanel',
title: 'Catalogos',
height: 212,
iconCls:'catalogos',
forceLayout: true,
collapsed: true,
collapsible: true,
rootVisible: false,
border: false,
autoWidth: true,
root: {
text: '',
isTarget: false,
expanded: true,
checked: false,
allowDrag: false,
allowDrop: false,
editable: false,
qtip: 1,
children: [
{
text: 'Regiones',
children: [
{
text: 'Estados111',
leaf: true,
listeners:{
itemclick:{

fn: function(){
Ext.Msg.alert('ExtJs is So Cool');
}
},
}

},
{
text: 'Municipios',
leaf: true
}
]
},










What is going on¿ thanks.:-?

mitchellsimoens
30 Nov 2011, 11:40 AM
You should put the itemclick listener on the tree panel itself.

Also, please post threads in the appropriate forum. I have moved this one.

icebergdelphi
30 Nov 2011, 12:07 PM
Ok Thanks but, in what part of my code? in ExtJs 3.3.x i've put my Listener event in the same place of my piece of code and works perfect, but in my ExtJs 4.0 example code where?

mitchellsimoens
30 Nov 2011, 12:14 PM
I said on the tree panel itself. So in the same level as the xtype : 'treepanel'

icebergdelphi
30 Nov 2011, 1:32 PM
I said on the tree panel itself. So in the same level as the xtype : 'treepanel' Ok Thanks, I saw much change, ExtJs ExtJS 3.x and 4.x, here is my code and resolved: items: [ { xtype: 'treepanel', title: 'Catalogos', height: 212, iconCls:'catalogos', forceLayout: true, collapsed: true, collapsible: true, rootVisible: false, border: false, autoWidth: true, listeners:{//Listeners apuntando a cada node itemclick:function(view, record, item, index, e) { if (index==1) { addTab(); } if (index==2) { Ext.Msg.alert('Title','Indice 2'); } } }, bla. bla. bla

icebergdelphi
30 Nov 2011, 1:36 PM
Ok Thanks, I saw much change, ExtJs ExtJS 3.x and 4.x, here is my code and resolved:



items: [
{ xtype: 'treepanel',
title: 'Catalogos',
height: 212,
iconCls:'catalogos',
forceLayout: true,
collapsed: true,
collapsible: true,
rootVisible: false,
border: false,
autoWidth: true,
listeners:{//Listeners apuntando a cada node
itemclick:function(view, record, item, index, e)
{
if (index==1)
{

addTab();
}
if (index==2)
{

Ext.Msg.alert('Title','Indice 2');
}
if (index==4)
{

Ext.Msg.alert('Title','Indice 4');
}

}
},
root: {
text: '',
isTarget: false,
expanded: true,
checked: false,
allowDrag: false,
allowDrop: false,
editable: false,
qtip: 1,
children: [
{
text: 'Regiones',
children: [
{
id:'IdEstados',
text: 'Estados',
leaf: true,


},
{
text: 'Municipios',
leaf: true
}
]
},
{
text: 'Usuarios',
children: [
{
el:'IdUsuarios',
text: 'Tree Node',
leaf: true
}
]
},
{
text: 'Solicitantes',
children: [
{
id:'Listado',
text: 'Listado',
leaf: true
}
]
}
]

},