1. #1
    Sencha User
    Join Date
    Jun 2011
    Posts
    3
    Vote Rating
    0
    jamesmacfie is on a distinguished road

      0  

    Default Problem loading nested JSON

    Problem loading nested JSON


    Hey everyone,

    I've been at this for a while now and I'm hoping my issue is simple. I'm having a problem loading some nested JSON. I've seen a few examples around where the common solution is to specify the root of the JSON and then to specify the record you want under that (or at least that's how I understand it).

    I've tried testing my JSON after removing the first level of the info and changing the root and removing the record specifications and that works fine. It's just when I try to load the second level that nothing works.

    My JSON:
    Code:
    {
        "ArrayOfWorkspace": {
            "Workspace": [
                {
                    "Id": "1",
                    "Title": "Large Education Project",
                    "Status": "OnTrack",
                    "StartDate": "2011-07-01T14:00:00",
                    "EndDate": "2011-07-23T14:00:00"
                },
                {
                    "Id": "2",
                    "Title": "Financial System Upgrade",
                    "Status": "AttentionNeeded",
                    "StartDate": "2011-07-14T00:00:00",
                    "EndDate": "2011-08-04T00:00:00"
                },
                {
                    "Id": "3",
                    "Title": "Large Government Project",
                    "Status": "OnTrack",
                    "StartDate": "2011-07-14T14:00:00",
                    "EndDate": "2011-07-21T14:00:00"
                }
            ]
        }
    }
    And the my code to deal with this info:
    Code:
    App.stores.workspaceStore = new Ext.data.JsonStore({
    	model: 'Workspace',
    	sorters: [{
    		property: 'Title',
    		direction: 'DESC'
    	}],
    	proxy: {
    		type: 'ajax',
    		url: 'Data/workspaces.json',
    		reader: {
    			type: 'json',
    			root: 'ArrayOfWorkspace',
    			record: 'Workspace'
    		}
    	}
    });
    Is there something I'm missing? At the moment I can't modify the JSON I'm getting back.

    Thanks,

    James

  2. #2
    Sencha User
    Join Date
    Jun 2011
    Posts
    3
    Vote Rating
    0
    jamesmacfie is on a distinguished road

      0  

    Default Easy solution

    Easy solution


    Right on, I got it all sorted now.

    To go down a level in my case I can specify the root as
    Code:
    root: 'ArrayOfWorkspace.Workspace'

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