【问题标题】:DOJO json layout structure is not working [closed]DOJO json布局结构不起作用[关闭]
【发布时间】:2013-02-19 12:22:30
【问题描述】:

我有一个这样的 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 来执行。我用过

 var layout4 = [{

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

这是行不通的。请帮助,在此先感谢

【问题讨论】:

  • 您实际尝试过什么?使用ItemFileReadStore 的代码在哪里? “不工作”是什么意思?您一直在关注哪些文档?你用的是哪个版本的道场?
  • 我尝试使用带有 json 响应的 dojo 创建网格
  • 您需要发布足够的信息,以便其他人能够重现您的问题。你还没有这样做!就像我在问你:你能帮我去图书馆吗?

标签: json dojo dojox.grid


【解决方案1】:

请尝试;

var layout4 = {
items : [{

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

在“标识符”字段中,输入您的“项目”中的字段名称,该名称将始终具有唯一值。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-11-14
    • 2012-09-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多