2013-07-12 76 views
0
Ext.define('MyApp.model.Facility', { 
    extend: 'Ext.data.Model', 

    requires: [ 
     'Ext.data.proxy.Ajax' 
    ], 

    config: { 
     fields: [ 
      { 
       name: 'FacilityId' 
      }, 
      { 
       name: 'FacilityName' 
      } 
     ] 
    } 
}); 

Ext.define('MyApp.store.FacilityStore', { 
    extend: 'Ext.data.Store', 

    requires: [ 
     'MyApp.model.Facility' 
    ], 

    config: { 
     autoLoad: true, 
     model: 'MyApp.model.Facility', 
     storeId: 'FacilityStore', 
     proxy: { 
      type: 'ajax', 
      batchActions: false, 
      url: 'http://localhost/QuickFind/Services/EquipmentService.asmx/GetFacilities', 
      headers: { 
       'content-type': 'application/json' 
      }, 
      reader: { 
       type: 'json', 
       rootProperty: 'd' 
      } 
     } 
    } 
}); 

而且數據試圖加載到列表中。Sench觸摸列表不渲染數據

Ext.define('MyApp.view.facilityList', { 
    extend: 'Ext.dataview.List', 
    alias: 'widget.facilityList', 

    config: { 
     docked: 'top', 
     height: 200, 
     id: 'datalist', 
     ui: 'round', 
     scrollable: true, 
     store: 'FacilityStore', 
     onItemDisclosure: true, 
     itemTpl: [ 
      '<div><p>{Facility.FacilityName}</p></div>' 
     ] 
    } 

}); 

和我的控制器推出我是數據綁定到列表:

Ext.define( 'MyApp.controller.Facility',{ 延長: 'Ext.app.Controller',

config: { 
    refs: { 
     dataList: '#dataList', 
     mainNav: 'mainNav' 
    } 
}, 

launch: function() { 

    var me = this; 

    debugger; 

    Ext.getStore('FacilityStore').load(); 
    var group_store = Ext.getStore("FacilityStore"); 

    me.facilityList.setStore(group_store); 

} 

店裝有記錄,但它不能在列表中顯示。

回答

0

我希望你已經被這個時候解決烏爾問題,但還是回答u有posted..the問題爲u寫的itemtpl的問題..

烏爾的

itemTpl: [ 
      '<div><p>{Facility.FacilityName}</p></div>' 
     ] 

的場u提到是FacilityName所以從商店Facility

u得到記錄的剛需要這樣做在烏拉圭回合itemtpl列表中獲取數據:

itemTpl: [ 
       '<div><p>{FacilityName}</p></div>' 
      ]