1. #1
    Sencha User firekesti's Avatar
    Join Date
    Sep 2012
    Posts
    22
    Answers
    2
    Vote Rating
    1
    firekesti is on a distinguished road

      0  

    Default Answered: Parsing RESTful JSON with links

    Answered: Parsing RESTful JSON with links


    I'm having a bit of a problem getting some of the data from a certain model to load. Here's a simplified version of my JSON representation:
    Code:
    "entry-list":[{
      "submitter":{
        "link":{
          "href":"/restapi/2.0/entity/23f03fe70a16aed0d7e210357164e401/",
          "rel":"entity",
          "phid":"Administrator"
        }
      },
      "id":"150858304dd049c3800645eadf07f78c",
      "entities":{
        "link":{
          "href":"/restapi/2.0/entry/150858304dd049c3800645eadf07f78c/entities/",
          "rel":"entities"
        }
      }
    }
    ]
    So, in my Model config, I can grab "id" quite simply,
    Code:
    { name: 'id' },
    and also "submitter" by using
    Code:
    { name: 'submitter',        mapping: 'submitter.link.phid' },
    but I cannot figure out how to get the list of "entities". Is this something I can do within the model, or do I need a special extension of the JSON reader?

    edit: For completeness, here is my Store implementation:
    Code:
    Ext.define("KT.store.EntryStore", {
        extend: "Ext.data.Store",
        
        config: {
            model: "KT.model.Entry",
            proxy: {
                type: 'rest',
                url: '/entry',
                noCache: false,
                limitParam: false,
                startParam: false,
                pageParam: false,
                extraParams: {
                	page: "1",
                	rpp: "10"
                },
                reader: {
                    type: "json",
                    rootProperty: "entry-list"
                }
            },
        }
    });
    Last edited by firekesti; 23 Oct 2012 at 2:14 PM. Reason: added Store implementation code

  2. Unfortunately there is no way to do this in Sencha's so-called REST proxy, as others have pointed out: http://www.sencha.com/forum/showthre...l-applications

    I cheated and used 'expand' to follow those links before looking at the JSON.

  3. #2
    Sencha User firekesti's Avatar
    Join Date
    Sep 2012
    Posts
    22
    Answers
    2
    Vote Rating
    1
    firekesti is on a distinguished road

      0  

    Default


    Unfortunately there is no way to do this in Sencha's so-called REST proxy, as others have pointed out: http://www.sencha.com/forum/showthre...l-applications

    I cheated and used 'expand' to follow those links before looking at the JSON.

Tags for this Thread

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar