关于Combox的使用总结

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

 mode : String

Acceptable values are: <div class="mdetail-params"> 'remote' : Default <p class="sub-desc">Automatically loads the st...
Acceptable values are:
  • 'remote' : Default

    Automatically 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);
 

你可能感兴趣的:(关于Combox的使用总结)