2010-08-27 60 views
6

我有文本框:如何隱藏帶有標籤的文本框?

  { 
       xtype: 'textfield', 
       fieldLabel: 'LBL_EMAIL', 
       anchor: '100%', 
       listeners: { 
        'render': function(p) { 
         // check certain conditions 
         this.hide() 
        } 
       }, 
      }, 

「隱藏()」只隱藏文本(無標籤),我想隱藏整個行(文本框和標籤)。 任何想法?

+0

哦,我儘量做到在聽衆,因爲我想顯示/隱藏它 「layoutConfig」 一些檢查... – 2010-08-27 13:06:44

回答

8

我找到了一個解決方案,我必須與配置的FormLayout:

trackLabels: true 
2

馬切伊的答案沒有工作,我更多。在Ext的默認把這個做的:

Ext.layout.FormLayout.prototype.trackLabels = true;

+1

PUT 「trackLabels」 後爲:layoutConfig:{ \t \t \t \t \t \t trackLabels:真 \t \t \t \t \t} – user427969 2012-04-13 04:55:30

0

使用類似:

yourElement.container.up('div.x-form-item').hide(); 
1

我不得不做以下,使其工作。

{ 
    xtype: 'textfield', 
    anchor: '100%', 
    listeners: { 
     'render': function(p) { 
      // hide label 
      Ext.getCmp('cluster_name').getEl().up('.x-form-item').setDisplayed(false); 
     } 
    }, 
}, 
1
Ext.getCmp('id of textfield').hide();