日期:2014-05-16  浏览次数:20677 次

Ext里面ComboBox的隐藏问题 - Web 开发 / Ajax
在隐藏ComboBox时,其fieldLabel不能被隐藏。我用的是2.0版本的Ext.

JScript code

var modelCb = new Ext.form.ComboBox({
            fieldLabel: '模型',
            hiddenName:'model',
            store: new Ext.data.SimpleStore({
                fields: ['Id', 'Name'],
                data : [
                    ['AL', 'Alabama', 'The Heart of Dixie'],
                    ['AK', 'Alaska', 'The Land of the Midnight Sun']
                ]
            }),
            valueField:'Id',
            displayField:'Name',
            hiddenName: 'op_objects',
            typeAhead: true,
            mode: 'local',
            triggerAction: 'all',
            emptyText:'-- 请选择 --',
            selectOnFocus:true
        });
modelCb.hide(); //这样不能隐藏fieldLabel




1、我希望隐藏掉整个ComboBox包括fieldLabel。
2、我希望能动态根据我的需要(如选择了人员fieldLabel就显示人员,选择了部门就显示部门)改变fieldLabel的值。如button的setText();一样。

------解决方案--------------------
建议使用formpanel.remove(modelCb)和formpanel.add(modelCb)或者insert