Ext.data.JsonStore 資料集使用

來源:互聯網
上載者:User

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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.