`

Ext.data.JsonStore 数据集使用

阅读更多

  ///
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);
          }
      }
 
  })

作者: 王德田 发表于 2011-04-02 13:39 原文链接

评论: 0 查看评论 发表评论


最新新闻:
· Spring.NET Visual Studio 2010 Extension 1.0.0(2011-04-08 08:50)
· 微软前工程师用谷歌地图建旅游搜索引擎(2011-04-08 08:49)
· 熊晓鸽:投资奇虎360回报率约50倍(2011-04-08 08:47)
· 永中科技创始人:永中office败于盗版 没输微软(2011-04-08 08:46)
· 惠普诉前高管非法窃取机密情报并提供给对手(2011-04-08 08:45)

编辑推荐:C#开发Android应用的必备——Mono for Android V1.0 发布

网站导航:博客园首页  我的园子  新闻  闪存  小组  博问  知识库

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics