Extjs中隐藏某个textfield以及label组件的方法

来源:互联网 发布:mac 如何打破折号 编辑:程序博客网 时间:2024/05/19 00:52

其实很简单,我做的就是在选择combox某一项的时候使得textfield和label出现

首先设置相对应的textfield和label   hidden为true使其隐藏,然后给他们添加上id

其次在combox中添加个时间listerns  通过index 获取点击的是那一个,然后用Ext.getCmp(id)方法获取组建,让他们setVisible(true)就好了

就是这么简单,你学会了么?

{
    // 类型
    width : 180,
    xtype : 'combo',

   store : new Ext.data.SimpleStore({
   fields: ['id', 'genre'],
   data : [
          ['0','New Genre'],
          ['1','Comedy'],
          ['2','Drama'],
          ['3','Action']
             ]
     }),
    valueField : 'name',
    editable : false,
    readOnly : true,
    displayField : 'text',
    mode : 'local',
    triggerAction : 'all',
    fieldLabel : Jer.Global.BUNDLE
      .getMsg("TopicSet.TopicTableType"),
    hiddenName : 'topicTableType',
    name : 'topicTableType',
    listeners : {
     select : function(combo, record, index){
      if(index == 2){
       Ext.getCmp('csql').setVisible(true);
       Ext.getCmp('connCode').setVisible(true);
      }
     }
    }
   },
   {
    id : 'csql',
    xtype : 'textarea',
    width : 300,
    height : 50,
    name : 'createSql',
    hidden : true,
    fieldLabel : Jer.Global.BUNDLE.getMsg("TopicTable.CreateSql")
   },

   {
    id : 'connCode',
    xtype : 'combo',
    name : 'connectionCode',
    inputValue : 'true',
    readOnly : false,
    editable : false,
    hidden : true,
    triggerAction : 'all',
    fieldLabel : Jer.Global.BUNDLE.getMsg("TargetConnectionPool"),
    mode : 'local',
    allowBlank : true,
    store : new Ext.data.Store(
      {
       proxy : new Ext.data.HttpProxy(
         {
          url : 'ExtControllerServlet?action=connectionPoolAction.findAllWithEmpty'
         }),
       reader : new Ext.data.JsonReader({
        root : 'data',
        totalCount : 'totalCount'
       }, [ {
        name : 'id'
       }, {
        name : 'code'
       }, {
        name : 'text'
       } ]),
       autoLoad : true
      }),
    displayField : 'text'
   } ],

在附上几个方法:setDisplay(),setVisible(),show(),hide()

原创粉丝点击