ExtJS - 根据其他Combo值隐藏ComboBox

时间:2011-07-20 15:00:23

标签: forms extjs combobox hidden-field

我有一个奇怪的问题,我定义的组合有隐藏:真实,这很好用,但是当我显示组合框并从中选择一个值时,它会隐藏。这是一些示例代码:

(我正在使用一些自定义扩展的ComboBox,但这不是问题)

第一个ComboBox:

var bulkImportType = {
    xtype: 'ibwComboLocal',
    fields: ['id', 'name'],
    data: [[1, '3rd Party Tag'], [2, 'Image'], [3, 'Template']],
    fieldLabel: 'Type',
    listeners: {
        'select': function(combo, record, index) {
            if (record.get('name') == 'Template') {
                this.bulkImportTemplateCombo.show();
            } else {
                this.bulkImportTemplateCombo.hide();
            }
        }, scope: this
    }
};

第二个ComboBox(仅在第一个Combo ==模板时显示)

var bulkImportTemplate = {
    xtype: 'ibwComboJson',
    hidden: 'true',
    url: 'http://itads-dl06.tweb.aol.com:3080/IBW/templates?returnJson=1',
    ref: '../bulkImportTemplateCombo',
    root: 'templateList',
    fieldLabel: 'Template'         
};

隐藏/显示工作正常,但似乎当我从“模板”下拉框中选择一个值时,它会重新触发配置并隐藏组合框。从表单中的其他组合中选择一个值似乎做同样的事情,但是只是那些远程调用(来自为组合返回JSON的URL)。

远程组合的“重置”表单配置的任何修复?

编辑:ComboBox的所有代码。所有这些都只是在FormPanel中呈现。

var inventorySelectDropdown = {
    xtype: 'ibwComboLocal',
    fields: ['id', 'name'],
    data: [[1, 'O&O'], [2, 'Network']],
    value: 1, // set to O&O by default
    fieldLabel: 'Inventory'
};

var bulkImportType = {
    xtype: 'ibwComboLocal',
    fields: ['id', 'name'],
    data: [[1, '3rd Party Tag'], [2, 'Image'], [3, 'Template']],
    fieldLabel: 'Type',
    listeners: {
        'select': function(combo, record, index) {
            if (record.get('name') == 'Template') {
                this.bulkImportTemplateCombo.show();
            } else {
                this.bulkImportTemplateCombo.hide();
            }
        }, scope: this
    }
};

var bulkImportTemplate = {
    xtype: 'ibwComboJson',
    hidden: 'true',
    url: 'xxx',
    ref: '../bulkImportTemplateCombo',
    root: 'templateList',
    fieldLabel: 'Template'         
};

var vendorDropdownBulk = {
    xtype: 'ibwComboJson',
    url: 'xxx',
    root: 'vendorList',
    fieldLabel: 'Vendor'
};

var bulkImportUploadField = {
    xtype: 'fileuploadfield',
    fieldLabel: 'Select Import File',
    width: 400
};

1 个答案:

答案 0 :(得分:0)

在'选择'监听器的if循环,在show()函数调用之后,添加以下语句:

this.bulkImportTemplateCombo.setVisible(true)
相关问题