繁体   English   中英

使用JsonStore的ExtJS 4 Panel Grid未加载网格

[英]ExtJS 4 Panel Grid using JsonStore is not loading the grid

我正在使用ExtJS 4.0.7,并且正在使用JSON存储将其加载到面板网格中。 我正在使用Firefox版本16.0.2。 这是一个非常简单的示例,我能够运行阵列网格。

Ext.onReady(function() {


var Grid1Store = new Ext.data.JsonStore({
    root: 'users',
    fields: [ 'id', 'name', 'email' ],
    autoLoad: true,
    data: { users: [ 
      { "id": 1, "name":"John Smith", "email":"jsmith@example.com"},
      { "id": 2, "name":"Anna Smith", "email":"asmith@example.com"},
      { "id": 3, "name":"Peter Smith", "email":"psmith@example.com"},
      { "id": 4, "name":"Tom Smith", "email":"tsmith@example.com"},
      { "id": 5, "name":"Andy Smith", "email":"asmith@example.com"},
      { "id": 6, "name":"Nick Smith", "email":"nsmith@example.com"}
    ]}
  });   


 var Grid1Grid = new Ext.grid.GridPanel({
      store: Grid1Store,
      renderTo: 'grid-example',
      title: 'Target',
      width: 300,
    columns: [
      {
        id: 'name',
        header: "Name",
        sortable: true,
        dataIndex: 'name'
      },{
        id: 'email',
        header: "Email",
        sortable: true,
        dataIndex: 'email'
      }
    ]

});

});

网格正在加载,没有数据显示。 它显示一个空白的网格。 我不确定这个问题。 是由于某些浏览器兼容性问题引起的吗?

您的商店是本地的。 不使用属性

var Grid1Store = new Ext.data.JsonStore({
  fields: [ 'id', 'name', 'email' ],
  autoLoad: true,
  data: [ 
    { "id": 1, "name":"John Smith", "email":"jsmith@example.com"},
    { "id": 2, "name":"Anna Smith", "email":"asmith@example.com"},
    { "id": 3, "name":"Peter Smith", "email":"psmith@example.com"},
    { "id": 4, "name":"Tom Smith", "email":"tsmith@example.com"},
    { "id": 5, "name":"Andy Smith", "email":"asmith@example.com"},
    { "id": 6, "name":"Nick Smith", "email":"nsmith@example.com"}
  ]
});   

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM