0

Sencha Touch は初めてで、WordPress への JSON 呼び出しを理解しようとしています。サーバー側の WordPress で JSON-API-for-BuddyPress プラグインを使用しています。

http://www.erefer.me/api/buddypressread/groups_get_groups/?username=troy

{"status":"ok","groups":{"149":{"name":"Barakah Biz Network Referrals","description":"This group is for B.B.N members to send and receive their referrals online.  This way all members have an online record of their referrals and no worries of losing pieces of paper.  You can easily view your referrals and contact them while they are hot.  You can also send referrals to other members that are tracked for prizes.  \r\n\r\nTracking how much business we do with each other is the only way to determine how effective we are at supporting each other in building our communities businesses together.  Members of this group but be member of BBN Network.","status":"public","creator":{"202":{"username":"bbnnetwork","mail":"victoria@bbnnetwork.org","display_name":"bbnnetwork"}},"slug":"barakah-biz-network-referrals","is_forum_enabled":false,"date_created":"2012-12-19 16:15:38","count_member":"4"},"57":{"name":"Troy\\'s Public List of Referral Partners","description":"List of referral partners that I share with the public.","status":"public","creator":{"1":{"username":"troy","mail":"troy@eRefer.Me","display_name":"troy"}},"slug":"troys-public-list-of-referral-partners","is_forum_enabled":false,"date_created":"2012-10-10 00:50:34","count_member":"2"},"40":{"name":"Austin RainMakers","description":"RainMakers of Austin Group ","status":"private"},"1":{"name":"Troy\\'s Private Network","description":"Troy\\'s Private Referral Network","status":"private"}},"count":4}

モデル:

Ext.define('eReferMe.model.Group', {
extend: 'Ext.data.Model',
config: {
        grouper: function(record) {
            return record.get('name')[0];
        },
        fields: ['id',
                 'name', 
             'description', 
             'status',
             'creator',
             'slug',
             'is_forum_enabled',
             'date_created',
             'count_member'
            ],
            autoLoad: true,

        proxy: {
            type: 'jsonp',
        url: 'http://www.erefer.me/api/buddypressread/groups_get_groups/?username=troy',
        reader: {
                    type: 'json',
                    successProperty: 'status',
                    rootProperty: 'groups',
                    totalProperty: 'count'


                   }
         }
}

});

店舗:

Ext.define('eReferMe.store.Groups', {
extend: 'Ext.data.Store',
config: {
    group: true,
    model: 'eReferMe.model.Group',
    sorters: 'name',
grouper : function(record) {
       return record.get('name')[0];
    }        

}  

});

他のフィールドと同様に ID が設定されていないことに関係しているのではないかと思いますが、よくわかりません。私は何が欠けていますか?

4

1 に答える 1

0

JSONP では、応答の「ラッパー」関数が必要です。この場合、リクエストの一部として渡されます。callback=Ext.data.JsonP.callback1

参照: jsonp コンテンツ タイプを使用した jQuery.ajax リクエスト後の parsererror

于 2013-01-30T06:25:50.227 に答える