1. #1
    Sencha User
    Join Date
    Feb 2012
    Posts
    31
    Vote Rating
    0
    gokulpotluri is on a distinguished road

      0  

    Default how to destroy the panel dynamically in extjs3.4

    how to destroy the panel dynamically in extjs3.4


    Hi,
    I am creating a panel with an id which is based on a flag
    Code:
     var that = this;
          alert(1 + ", " + that.isClone + ", " + recordId)
          var panelID = this.entityType + this.wfContext + recordId;
          if(that.isClone)
                 panelID = this.entityType + this.wfContext + recordId + '_clone';
          alert(2 + ", " + panelID)
          this.panel = new Ext.Panel({
           id : panelID,
           title : 'Loading...',
           layout: 'fit',
           border: false,
           autoScroll : true,
           closable: true,
           bodyStyle: {
            'padding': '0px',
            'background': '#FFFFFF',
            'overflow-x': 'hidden'
           },
           getRequestObject : function(){
            return that;
           }
          });
    And i am trying to delete this panel(this.panel) in some other function which is in the same class

    Code:
     onSubmit : function(recordId){
          alert(1 + ", " + this.panel + ", " + this.panel.id)
          this.panel.destroy();
          alert(2)
          new sd.openRequest({
           entityType : this.entityType,
           wfContext : this.wfContext,
           recordId : recordId,
           aftercreate : this.aftercreate
          });
         }
    but it is giving js error called 'Style' is null or not an object at the line this.panel.destroy(); after alert(1) in onSubmit function. Even alert(2) is not getting rendered.

    Advance thanks for help.

  2. #2
    Sencha User
    Join Date
    Jan 2011
    Posts
    544
    Vote Rating
    51
    willigogs is a jewel in the rough willigogs is a jewel in the rough willigogs is a jewel in the rough

      0  

    Default


    Is this.panel returning an EXT Panel in order to run the destroy() function against?

    Perform console.log() against "this" and "this.panel" (console.log(this, this.panel)) to see what the actual variable is.

    I would always recommend using Firebug and Illuminations within Firefox when debugging, rather than alert().

    https://getfirebug.com/
    http://www.illuminations-for-developers.com/

Thread Participants: 1

Tags for this Thread