【问题标题】:Clearing multiple comboboxes and inputfields - Ext JS清除多个组合框和输入字段 - Ext JS
【发布时间】:2013-08-12 17:27:29
【问题描述】:

我有以下带有组合框和文本字段的容器(我还有一个添加函数来动态添加成对的组合/文本字段):

{ xtype: 'container', layout: 'hbox', style: {margin: '0px 0px 0px 330px'},
   items: [
     { xtype: 'combobox', padding: 5,   id: 'criteria_1_dropdown', store: filters},
     { xtype: 'textfield', padding: 5,  id: 'criteria_1_input', width: 145}
   ] 
 }

和按钮:

{ xtype: 'button', id: 'clear_criteria', iconCls: 'clear' } 

我想要做的是启用“清除”按钮以在单击时清除任何和所有组合/文本字段组件,我认为它不需要它自己的控制器来实现这一点。有什么想法吗?

【问题讨论】:

    标签: button extjs xtype


    【解决方案1】:

    我通过将表单放入变量并使用 reset() 函数重置该表单来解决问题:

    { xtype: 'button', id: 'clear_criteria', iconCls: 'clear',
         handler: function() { 
             var hi = Ext.getCmp('contain'); 
             hi.getForm().reset(); 
             console.log('Cleared Search'); 
       }  
    } 
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-07-30
      • 1970-01-01
      • 1970-01-01
      • 2020-10-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多