1. #1
    Sencha User
    Join Date
    Oct 2011
    Posts
    2
    Answers
    1
    Vote Rating
    0
    jamesnpope is on a distinguished road

      0  

    Question Answered: jsonreader: how to get the totalProperty from a nested JSon value?

    Answered: jsonreader: how to get the totalProperty from a nested JSon value?


    Hi,

    How can I define the totalProperty config value of my Jsonreader to use a value from my JSon response that is nested a few levels down? If you look at the JSON response below, I need the totalProperty value to be taken from queries/request/totalResults...

    JSON response:
    {
    "queries": {
    "request": [{
    "totalResults": "87200"
    }]
    },
    "items": [
    {"title": "The title"},
    {"title": "The title"}
    ]
    }

    Thanks in advance,

    James

  2. Found it...

    totalProperty: 'queries.request[0].totalResults'

  3. #2
    Sencha User
    Join Date
    Oct 2011
    Posts
    2
    Answers
    1
    Vote Rating
    0
    jamesnpope is on a distinguished road

      0  

    Red face [SOLVED]

    [SOLVED]


    Found it...

    totalProperty: 'queries.request[0].totalResults'

  4. #3
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,996
    Answers
    464
    Vote Rating
    649
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    That works. For more complicated stuff a function would work too.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

Thread Participants: 1