Hi, I'm trying to get some simple data into a JsonStore, but it doesn't seem to work. The code is pretty much the same as examples:
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'},
]
}
...
Unfortunately this doesn't work. The table loads with no rows and the count on the store is 68 (as returned by server, got via listview.getStore().getCount()
). If I substitute JsonStore with an ArrayStore and some static data, I can see them.
The result from /items/list
is just:
{"items":
[{"id": "a", "name": "Some name"},
{"id": "b", "name": "Some other name"}]
}
How do I fix this? How do I even debug this?
Edit: updated the information about record count