如何在extJS中设置容器内的复选框值

时间:2017-05-03 09:00:41

标签: javascript extjs

我正在尝试将checkbox值设置为false。但我在设定价值时遇到错误。 bellow是我的复选框代码..

 this.checkCombobox = Ext.create('Ext.container.Container', {
        layout: 'hbox',
        width: '3%',
        items: [{
            xtype: 'checkbox',
            margin: '22 10 0 0',
            boxLabel: 'All',
            //width: '10%',
            listeners: {
                scope: this,
                change: function (cmp, newVal, oldVal) {
                    var combo = this.DriverNameCombo;
                    var records = combo.getStore().getRange();
                    if (newVal) {
                        combo.setValue(records, true);
                    }
                    else {
                        combo.reset();
                        combo.setValue([], false);
                    }
                }
            }
        }]
    });

我想取消选中其他组件事件的复选框。 表示我想取消选中组合框选择事件的复选框。 bello是我的组合代码。

     this.companyCombo = new Ext.form.field.ComboBox({
            xtype: 'combobox',
            width: '10%',
            fieldLabel: fleet.Language.get('_FLEET_REPORTS_COMPANY_'),
            blankText: fleet.Language.get('_FLEET_REQUIRED_ERROR_'),
            labelAlign: 'top',
            queryMode: 'local',
            displayField: 'name',
            valueField: 'companyId',
            allowBlank: false,
            editable: true,
            store: Ext.getStore('userStore').first().companies(),
            enableKeyEvents: true,
            listeners: {
                scope: this,
                select: function (t, recs) {
//here I want to uncheck that checkbox if it is cheched.
                    //this.checkCombobox.items.setValue(false);
                    this.DriverNameCombo.reset();
                    recs[0].loadCompany({
                        scope: this,
                        callBack: function () {
                            this.DriverNameCombo.bindStore(recs[0].drivers());
                        }
                    });
                }
});

enter image description here

查看上图,如果我从公司下拉列表中选择其他项目,那么我想取消选中所有检查按钮

0 个答案:

没有答案