Sencha Touch JsonPreader
-
25-10-2019 - |
質問
Sencha Touch 2を使用して、JSONプロキシでNestedListをレンダリングしようとしています。 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'
}
}
}
});
今私が得ているのはエラーです。
これを解決する方法についての洞察を提供したり、カスタム解析やアイテムを店に戻す方法についての洞察を提供できますか?
ありがとう
========更新 - rootPropertyが読者で動作するためには、JSONはJSONアレイではなくJSonObjectでなければなりませんでした。
{
"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"
}
},
.......
解決
あなたのJSONは配列のように見えます。エラーメッセージは、コードが未定義の変数またはプロパティのプロパティにアクセスしようとすることを意味します。
私の最初の推測では、読者がその配列タイプJSON形式に対して適切に構成されていないことです。
所属していません StackOverflow