Results 1 to 6 of 6

Thread: Treepanel Listener event does not works ExtJs 4.0.7

  1. #1
    Sencha User
    Join Date
    Nov 2010
    Location
    Villaflores,Chiapas,Mexico
    Posts
    92
    Answers
    9
    Vote Rating
    2
      0  

    Default 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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,412
    Answers
    3898
    Vote Rating
    1288
      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 @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it!

    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
    92
    Answers
    9
    Vote Rating
    2
      0  

    Default 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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,412
    Answers
    3898
    Vote Rating
    1288
      0  

    Default

    I said on the tree panel itself. So in the same level as the xtype : 'treepanel'
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it!

    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
    92
    Answers
    9
    Vote Rating
    2
      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
    92
    Answers
    9
    Vote Rating
    2
      0  

    Default 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
                                            }
                                        ]
                                    }
                                ]
                            
                            },
    
    

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •