1. #1
    Sencha User
    Join Date
    Nov 2010
    Location
    Villaflores,Chiapas,Mexico
    Posts
    90
    Vote Rating
    2
    Answers
    8
    icebergdelphi is on a distinguished road

      0  

    Default Unanswered: Treepanel Listener event does not works ExtJs 4.0.7

    Unanswered: Treepanel Listener event does not works ExtJs 4.0.7


    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:
    HTML 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.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,650
    Vote Rating
    898
    Answers
    3575
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    You should put the itemclick listener on the tree panel itself.

    Also, please post threads in the appropriate forum. I have moved this one.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Nov 2010
    Location
    Villaflores,Chiapas,Mexico
    Posts
    90
    Vote Rating
    2
    Answers
    8
    icebergdelphi is on a distinguished road

      0  

    Default Tnaks but where? or how?

    Tnaks but where? or how?


    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?

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,650
    Vote Rating
    898
    Answers
    3575
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    I said on the tree panel itself. So in the same level as the xtype : 'treepanel'
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  5. #5
    Sencha User
    Join Date
    Nov 2010
    Location
    Villaflores,Chiapas,Mexico
    Posts
    90
    Vote Rating
    2
    Answers
    8
    icebergdelphi is on a distinguished road

      0  

    Default


    Quote Originally Posted by mitchellsimoens View Post
    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

  6. #6
    Sencha User
    Join Date
    Nov 2010
    Location
    Villaflores,Chiapas,Mexico
    Posts
    90
    Vote Rating
    2
    Answers
    8
    icebergdelphi is on a distinguished road

      0  

    Default Thanks

    Thanks


    Ok Thanks, I saw much change, ExtJs ExtJS 3.x and 4.x, here is my code and resolved:
    HTML Code:
    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
                                            }
                                        ]
                                    }
                                ]
                            
                            },
    
    

Thread Participants: 1