Используя sencha touch 2, я пытаюсь отобразить вложенный список с прокси json.JSON выглядит как
[
{
"start": "0"
},
{
"format": "json"
},
.......
{
"GetFolderListing": [
{
"folder": {
"total": 0,
"id": "Calendar",
"name": "Calendar",
"unread": 0,
}
},
{
"folder": {
"total": 0,
"id": "Contacts",
"name": "Contacts",
"unread": 0,
}
},
.......
Я хочу использовать GetFolderListing.folder.name в качестве displayField Мой магазин выглядит как
Ext.define('foo.store.FolderListing', {
extend: 'Ext.data.TreeStore',
require: ['foo.model.FolderListing'],
config: {
model: 'foo.model.FolderListing',
recursive: true,
proxy: {
type: 'jsonp',
url: 'http://localhost/?xx=yy&format=json',
callbackKey: "jsoncallback",
reader: {
type: 'json',
rootProperty: 'GetFolderListing',
record: 'folder'
}
}
}
});
Сейчас все, что я получаю, это ошибка Uncaught TypeError: Cannotчитать свойство 'id' из неопределенного
Может ли кто-нибудь дать представление о том, как решить эту проблему или лучше отладить ее или как выполнить собственный анализ и передать элементы обратно в магазин?
Спасибо
======== Обновление - чтобы rootProperty работал в читателе, json должен был быть jsonobject, а не массивом json, например
{
"GetFolderListing": [
{
"folder": {
"total": 0,
"id": "Contacts",
"name": "Contacts",
"unread": 0,
"leaf": "true"
}
},
{
"folder": {
"total": 0,
"id": "Conversation Action Settings",
"name": "Conversation Action Settings",
"unread": 0,
"leaf": "true"
}
},
.......