1. #1
    Sencha User
    Join Date
    Oct 2010
    Posts
    11
    Vote Rating
    0
    jkristen is on a distinguished road

      0  

    Default read json data with model

    read json data with model


    Hey guys,

    i'm trying to read json data from server with a Ext.regModel component. The examples from Sencha API Documentation are not useful for me. The json response i get, contains a other structure. How can i parse a structur like this.
    Code:
     {
        "car":{
            "id":"971",
            "distance":null,
            "expires":"2011-02-28 22:59:00",
            "remaining":null,
            "remaining_interval":"20000",
            "isbookmarked":"0",
            "url":"....",
            "customer":{
                "id":"794",
                "icon":"...",
                "title":"..."        },
            "affiliate":{
                "id":"30",
                "icon":"...",
                "title":"..."        },
            "title":"BMW",
            "description":".....",
            "image":"...."
        }
    thanks

  2. #2
    Sencha User
    Join Date
    Oct 2010
    Posts
    11
    Vote Rating
    0
    jkristen is on a distinguished road

      0  

    Default


    additional information:
    my Problem ist to read/parse the "customer" Object in this Json structure.
    Code:
    [
        {
        "car":{
            "id":"253",
            "distance":"...",
            "expires":"...",
            "customer":{
                "id":"175",
                "title":"...."        
            },
            "affiliate":{
                "id":"1",
                "title":"...."        
            },
            "title":"BMW",
            "image":"....gif"
        }
    },{
        "car":{
            "id":"955",
            "distance":"...",
            "expires":"...",
            "customer":{
                "id":"780",
                "title":"...."
            },
            "affiliate":{
                "id":"30",
                "title":"...."        
            },
            "title":"Audi",
            "image":"..."
        }
    }]
    i use currently a "regModel" to pars the Car Object and that looks fine for me.
    Code:
    	Ext.regModel('CarList', {
    			fields: ['title', 'image', 'distance', 'expires', 'id']
    but how get i access to the customer and affiliate object?
    i tryed to set customer.title in the "reg.Model" and figure out that the "car" object actually contains the customer.title value but i can not access to this via the tpl tag of my "Ext.list".
    Code:
    {(customer.title)}

Similar Threads

  1. store read data from Json Data
    By szxiaoyin in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 10 May 2010, 3:44 AM
  2. can to read json data
    By starstar in forum Ext 3.x: Help & Discussion
    Replies: 23
    Last Post: 30 Dec 2009, 7:45 AM
  3. How to read json data ?
    By sapatel in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 25 Mar 2009, 12:31 PM
  4. How to read JSON Data into a grid
    By sonic64 in forum Ext 1.x: Help & Discussion
    Replies: 5
    Last Post: 4 Apr 2007, 7:28 AM
  5. JSON Data Model?
    By cobnet in forum Ext 1.x: Help & Discussion
    Replies: 2
    Last Post: 1 Mar 2007, 1:16 AM

Tags for this Thread