Sencha Touch JSON Analysis Complex

I asked on the Sencha Touch forums, but I didn't have a great answer (well, actually, no). I wonder if anyone can help. I want to create a list of elements from a JSON response received from a PHP script. Here is a JSON example received from PHP:

{
   "friends":[
      {
         "friend":{
            "id":"4",
            "forename":"Chris",
            "surname":"Major",
            "verboseName":"Chris Major",
            "phoneNumber":"07931655247",
            "longitude":"-0.410909",
            "latitude":"52.999245",
            "email":"major@lincsmps.co.uk",
            "lastRefresh":null,
            "joinDate":"1294839423"
         },
         "networks":null,
         "approved":"1"
      },
      {
         "friend":{
            "id":"2",
            "forename":"Marta",
            "surname":"Urbanowicz",
            "verboseName":"Marta Urbanowicz",
            "phoneNumber":"07716021468",
            "longitude":"-0.0338518",
            "latitude":"52.9773876",
            "email":"urb.marta@googlemail.com",
            "lastRefresh":null,
            "joinDate":"1294836801"
         },
         "networks":null,
         "approved":"1"
      }
   ]
}

I would like to know how I can parse this in a DataStore and then display a grouped list in Sencha Touch. Although there are examples of using standard JSON responses for ListView, there seems to be no nested example such as this ...

Any help gratefully received.

+3
source share
1 answer

Ben

What you can do is declare your friends store with fields with the fields you want (perhaps id, last name, email address, network approved).

, Ajax, .

"". "", "" :

var friend = {id: '2', : 'whatever', email:'whatever@blah.com '}

. json.

, , , .

+1

All Articles