2011-04-18 79 views
2

對於內部組合框複選框我使用:ExtJS的組合與複選框

AOEDComboAssociationName = new Ext.form.ComboBox({ 
    id: 'AOEDComboAssociationName', 
    store: AOEDstoreAssociationName, 
    displayField: 'Name', 
    valueField: 'Id', 
    typeAhead: true, 
    mode: 'local', 
    emptyText: '', 
    selectOnFocus: true, 
    triggerAction: 'all', 
    width: 220, 
    tpl: new Ext.XTemplate('<tpl for=".">' 
     + '<div class="search-item" >' 
     + '<input type="checkbox" class=" x-form-checkbox x-form-field">&nbsp;{Name}' 
     + '</div></tpl>' 
     ) 
}) 

其顯示與組合顯示領域一起復選框,但是當我選擇一個項目組合自動崩潰了,所以再次點擊組合的選擇多(另一項)

我該如何檢查多次?

回答

1

這是一個完全黑客攻擊,但我認爲你可以在你的子類中覆蓋

// private 
onSelect : function(record, index){ 
    if(this.fireEvent('beforeselect', this, record, index) !== false){ 
     this.setValue(record.data[this.valueField || this.displayField]); 
     this.collapse(); 
     this.fireEvent('select', this, record, index); 
    } 
}, 
//… 

// private 
onSelect : function(record, index){ 
    if(this.fireEvent('beforeselect', this, record, index) !== false){ 
     this.setValue(record.data[this.valueField || this.displayField]); 
     //this.collapse(); 
     this.fireEvent('select', this, record, index); 
    } 
}, 
//… 

如果您不希望覆蓋任何東西,你可以隨時通過取消ONSELECT碼在'beforeselect'事件中返回false,但你必須自己對setValue()和fireEvent('select')做些什麼。

2

我該如何檢查多次?

此設置在下拉列表:

multiSelect: true