我正在尝试将一些简单的数据放入 JsonStore,但它似乎不起作用。代码与示例几乎相同:
var itemListStore = new Ext.data.JsonStore({
   url: '/items/list',
   root: 'items',
   fields: [
      {name: 'id', type: 'string'},
      {name: 'name', type: 'string'},
   ]
});
itemListStore.load(); 
...
      items: [
      {
         xtype: 'listview',
         store: itemListStore,
         columnResize: false,
         flex: 1,
         columns: [
            {header: 'ID', dataIndex: 'id'},
            {header: 'Name', dataIndex: 'name'},
         ]
      }
...
不幸的是,这不起作用。该表加载时没有行,并且存储的计数为 68(由服务器返回,通过 获取listview.getStore().getCount())。如果我用 ArrayStore 和一些静态数据替换 JsonStore,我可以看到它们。
结果/items/list只是:
{"items":
    [{"id": "a", "name": "Some name"},
    {"id": "b", "name": "Some other name"}]
}
我该如何解决?我该如何调试呢?
编辑:更新了有关记录数的信息