1:关于ComboBox中mode的属性(Ext Js 3.x)

 ​mode​ : String


Acceptable values are: <div > 'remote' : Default <p >Automatically loads the st...



  • 'remote':DefaultAutomatically loads the​​store​​ the first time the trigger is clicked. If you do not want the store to be automatically loaded the first time the trigger is clicked, set to 'local' and manually load the store. To force a requery of the store every time the trigger is clicked see ​​lastQuery​​.
  • 'local':ComboBox loads local data
  • var combo = new Ext.form.ComboBox({
        renderTo: document.body,
        mode: 'local',
        store: new Ext.data.ArrayStore({
            id: 0,
            fields: [
                'myId'// numeric value is the key
                'displayText'
            ],
            data: [[1, 'item1'], [2, 'item2']]  // data is local
        }),
        valueField: 'myId',
        displayField: 'displayText',
        triggerAction: 'all'
    });​



2: 在Ext Js 4.x中ComboBox的应用
// The data store containing the list of states 
var states = Ext.create('Ext.data.Store', { fields: ['abbr', 'name'],
data : [ {"abbr":"AL", "name":"Alabama"},
{"abbr":"AK", "name":"Alaska"}, {"abbr":"AZ", "name":"Arizona"}
//... ]});// Create the combo box, attached to the states data store
Ext.create('Ext.form.ComboBox', { fieldLabel: 'Choose State',
store: states, queryMode: 'local', displayField: 'name',
valueField: 'abbr', renderTo: Ext.getBody()});
关于Event的使用:
var cb = Ext.create('Ext.form.ComboBox', {    // all of your config options 
listeners:{ scope: yourScope, 'select': yourFunction }});
// Alternatively, you can assign events after the object is created:
var cb = new Ext.form.field.ComboBox(yourOptions);
cb.on('select', yourFunction, yourScope);