C#技术百科
问问你的心你有没有信心 做事情要专一坚定,执着

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

posted on 2011-04-02 13:39  王德田  阅读(3612)  评论(1编辑  收藏  举报