2012-09-05 33 views
0

我有一個名爲employee的表。 empid和empname是2個字段。我想通過Web服務將數據從該表中獲取到sencha觸摸列表視圖。我的web服務正在返回json數據;我的意思是我把輸出轉換成json。我的JavaScript代碼如下無法將數據從webservice獲取到sencha觸摸列表視圖

Ext.data.JsonStore({ 
     proxy: new Ext.data.HttpProxy({ 
     url: 'http://localhost:58984/Service1.asmx/GetListData', // werservicename.asmx/webMethodName 
     headers: { 
        'content-type': 'application/json' 
       } 
     }), 
     root: 'd', 
     idProperty: 'empid', // provide the unique id of the row 
     fields: [empname] // specify the array of fields 
    }); 

    itemTpl: '{empname}' 

但我得到2個錯誤:

  1. empname沒有定義
  2. 即使他們的文件已加載以下類不聲明:「Acsellerate .view.Main'。請檢查可能的拼寫錯誤的對應文件的源代碼:「應用程序/視圖/ Main.js

回答

0

,如果你指出究竟在何處錯誤發生這將是一件好事,但對於NR1的問題可能fields: [empname]應該是fields: ['empname']

不知道NR1和NR2是相關的,但是如果固定的第一個錯誤不能解決你的問題,你真的需要向我們展示你的Main.js

希望這有助於