2013-03-05 61 views
3

我有這樣道場JSON佈局結構不工作

{ 
    "listResponse": 
    { 
     "page":0, 
     "rows":10, 
     "total":9, 

     "items": [ 
     { "abbr": "ec", "name": "Ecuador", "capital": "Quito" }, 
     { "abbr": "eg", "name": "Egypt", "capital": "Cairo" }, 
     { "abbr": "sv", "name": "El Salvador", "capital": "San Salvador" }, 
     { "abbr": "gq", "name": "Equatorial Guinea", "capital": "Malabo" }, 
     { "abbr": "er", "name": "Eritrea", "capital": "Asmara" }, 
     { "abbr": "ee", "name": "Estonia", "capital": "Tallinn" }, 
     { "abbr": "et", "name": "Ethiopia", "capital": "Addis Ababa" } 
     ] 
    } 
} 

我需要使用Dojo data.ItemFileReadStore到excecute JSON響應。我用

var layout4 = [{ 

      field: 'abbr', 
      name: 'Abbr', 
      width: '200px' 
     }, 
     { 
      field: 'name', 
      name: 'First Name', 
      width: '200px' 
     }, 
     { 
      field: 'capital', 
      name: 'Capital', 
      width: '200px' 
     } 

這是行不通的。幫助請提前感謝

+3

你究竟試過了什麼?你的代碼在哪裏使用'ItemFileReadStore'? 「不工作」是什麼意思?你一直在關注哪些文檔?你正在使用哪種版本的dojo? – 2013-03-05 08:43:14

+0

我嘗試使用dojo創建網格並使用json響應 – 2013-03-05 09:26:16

+0

您需要發佈足夠的信息以便其他人能夠重現您的問題。你沒有那樣做!這就像我問你這個問題:你能幫我去圖書館嗎? – 2013-03-07 14:45:58

回答

0

請嘗試;

var layout4 = { 
items : [{ 

     field: 'abbr', 
     name: 'Abbr', 
     width: '200px' 
    }, 
    { 
     field: 'name', 
     name: 'First Name', 
     width: '200px' 
    }, 
    { 
     field: 'capital', 
     name: 'Capital', 
     width: '200px' 
    }], 
identifier :"field" 
}; 

在「標識」字段給字段的名稱從「項目」,這將永遠有一個獨特的價值。