Results 1 to 3 of 3

Thread: How to remove/delete some property of some class

  1. #1

    Default How to remove/delete some property of some class

    Hi all,
    I am new to extjs. Please help me . i have a tab panel and within that panel I have a form.

    I basically have 2 classes

    1) myTabPanel
    2) myFormPanel
    I have embedded myFormPanel inside myTabPanel.

    Now since i want to reuse my classes. i want to have the formPanel to have a predefined title
    but I dont want to have it when I use it from tabpanel as tabpanel has one of its own.

    below is my sample code

    myFormPanel = Ext.extend(Ext.form.FormPanel, {
    labelWidth : 75,
    frame : false,
    defaultType : 'textfield',
    title : 'hello',

    /*
    ........


    .....

    });

    myTabPanel = Ext.extend(Ext.TabPanel, {
    layout : 'border',
    title : 'Create Case',
    frame : true,
    bodyBorder : false,
    form : new myFormPanel(),

    initComponent : function() {

    this.form.title = null;

    //The above line does not help...Basically I want to check if myTabPanel has title I dont want title in the formPanel. But I want to have it in the Class since I may want it to be used somwhere else..Also wat happens when I make it null there is a small line rendered on the top of the form which is annoying


    Can someone please help

  2. #2
    Sencha User
    Join Date
    Jan 2008
    Location
    Toronto, Canada
    Posts
    481

    Default

    Your problem has nothing to do with Ext JS. What you need is is delete operator in JavaScript.

    https://developer.mozilla.org/en/Cor...elete_Operator

  3. #3

    Default

    Pass a config when you create your formPanel something like "inform: true". You can then check that in your formPanel whether you want title or not. So your formPanel code will change like this:

    Code:
    myFormPanel = Ext.extend(Ext.form.FormPanel, {
    labelWidth : 75,
    frame : false,	
    defaultType : 'textfield',
    // don't add the title here
    //title : 'hello',
    
        initComponent: function(){
            if(this.inForm){
                this.header = false;
            }else{
                this.title = "hello"; 
            }
            // any other default properties you want to apply
            Ext.apply(this, {});
            
        }
    
    /*
    ........
    
    
    .....
    
    });

Posting Permissions

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