2011-03-11 69 views

回答

0

基本的例子應該是這樣的:

var combo = new Ext.form.ComboBox({ 
    typeAhead: true, 
    triggerAction: 'all', 
    store: new Ext.data.JsonStore({ 
    reader: new Ext.data.JasonReader ({ 
     fields: [ 'myId', 'displayText' ], 
     root: 'rows' 
    }), 
    proxy: new Ext.data.HttpProxy ({ 
     url: 'path/to/your/script.aspx' 
    }) 
    valueField: 'myId', 
    displayField: 'displayText' 
}); 

其中/path/to/your/script.aspx返回數據是這樣的:

{"success":true,"total":4,"rows":[ 
    {"myId":"1","displayText":"Option 1"}, 
    {"myId":"2","displayText":"Option 2"}, 
    {"myId":"3","displayText":"Option 3"}, 
    {"myId":"4","displayText":"Option 4"} 
]}