您的位置:首页 > Web前端 > JavaScript

Ext.data.JsonStore 数据集使用

2011-04-02 13:39 513 查看
///
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);
}
}

})
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: