Results 1 to 4 of 4

Thread: Error on collapse listener

  1. #1
    Sencha User
    Join Date
    Jun 2011
    Posts
    185
    Answers
    6

    Default Error on collapse listener

    I'm getting this error on collapse listener.

    me.el is null
    listener code:
    Code:
    collapse: {
                        fn: function(){ 
                            var centerWidth         = Ext.getCmp('centerPanel').getWidth();
                            var centerHeight     = Ext.getCmp('centerPanel').getHeight();
                            
                            console.info("centerWidth: "+centerWidth);
                            console.info("centerHeight: "+centerHeight);
                        }
    Thanks !

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,410
    Answers
    716

    Default

    Please try the following:

    Code:
    Ext.create('Ext.panel.Panel', {
        id: 'centerPanel',
        title: 'Hello',
        width: 300,
        collapsible: true,
        html: '<p>World!</p>',
        renderTo: Ext.getBody(),
        
        collapse: function(){ 
                var centerWidth   = Ext.getCmp('centerPanel').getWidth();
                var centerHeight  = Ext.getCmp('centerPanel').getHeight();
                
                console.info("centerWidth: "+centerWidth);
                console.info("centerHeight: "+centerHeight);
            }    
        }    
        
    });
    result from console:
    centerWidth: 300
    centerHeight: 42

    Regards,
    Scott.

  3. #3
    Sencha User
    Join Date
    Jun 2011
    Posts
    185
    Answers
    6

    Default

    it worked but the panel doesn't collapse after i click on the collapse button.


  4. #4
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,410
    Answers
    716

    Default

    I must have been asleep when I answered this ...

    try:
    Code:
    Ext.create('Ext.panel.Panel', {
        id: 'centerPanel',
        title: 'Hello',
        width: 300,
        collapsible: true,
        html: '<p>World!</p>',
        renderTo: Ext.getBody(),
        
        listeners: {
            
            collapse: function(){ 
                var centerWidth   = Ext.getCmp('centerPanel').getWidth();
                var centerHeight  = Ext.getCmp('centerPanel').getHeight();
                
                console.info("centerWidth: "+centerWidth);
                console.info("centerHeight: "+centerHeight);
            }    
        }    
        
    });
    Regards,
    Scott.

Posting Permissions

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