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

      0  

    Default Unanswered: how to destroy the panel dynamically in extjs

    Unanswered: how to destroy the panel dynamically in extjs


    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
    Touch Premium Member
    Join Date
    Jun 2011
    Posts
    1,088
    Answers
    112
    Vote Rating
    95
    Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light

      0  

    Default


    if you are assigning an id to your panel, you can try using:

    Code:
    Ext.getCmp(this.panel.id).destroy();

Thread Participants: 1

Tags for this Thread