///
var store12=new Ext.data.JsonStore({
//results 表示结果数
//rows 表示从后台传过来的JSON数据
data:{ "results": 2, "rows":[
{"id":1, "city": "suzhou", "areacode": "0512", "perincome": "2500" },
{"id":2, "city": "nanjing", "areacode": "025", "perincome": "2200" }]},
//自动加载(不能用store.load())
autoLoad:true,
totalProperty:"results",
root:"rows",
fields:[{name:'city',mapping:'city'},
{name:'areacode',type:'int'},
{name:'perincome',mapping:'perincome',type:'int'},
{name:'id',mapping:'id',type:'int'}
]
});
var bottomSearch12 = new Ext.form.ComboBox({
fieldLabel: 'Country Code',
name: 'country_code',
forceSelection: true,
listWidth: 200,
store: store12,
valueField: 'areacode',
displayField: 'city',
typeAhead: true,
mode: 'local',
triggerAction: 'all',
selectOnFocus: true, //用户不能自己输入,只能选择列表中有的记录
allowBlank: false,
listeners: {
select: function() {
alert(this.value);
}
}
})