1. #1
    Sencha User
    Join Date
    Jun 2012
    Posts
    2
    Vote Rating
    0
    poweranimal is on a distinguished road

      0  

    Default Unanswered: Loading nested data into two different stores

    Unanswered: Loading nested data into two different stores


    I have two models that are related. One is called 'Changes' and belongsTo a 'Configuration'. This is how I've defined the association on a 'Change':

    Code:
    associations: [{
                type:'belongsTo', 
                model:'Changes.model.Configuration',
                primaryKey: 'id',
                foreignKey: 'configuration_id',
                associationKey: 'configurations'
            }],
    On the changes store I have a proxy defined like this:
    Code:
    proxy: {
                type: 'ajax',
                url: 'services/changes.php',
                reader: {
                    type: 'json',
                    rootProperty: 'changes'
                }
           },
    When the store is loaded it is passed a JSON object that looks like this:
    Code:
    {
        "success": true,
        "changes": [
            {
                "id": 1,
                "changeId": "CMS19178263",
                "briefDescription": "Loaded from Proxy!!!",
                "configuration_id": 3,
                "configurations": [
                    {
                        "id": "3",
                        "longName": "002669-2669-abc_-_windows_7_desktop.Computer.Windows",
                        "ciName": "002669-2669-abc_-_windows_7_desktop"
                    }
                ]
            }
        ]
    }
    When the record gets loaded I can call 'record.getConfiguration()' but all of the fields in 'data' show null (except id shows: ext-record-9). Inside the raw array there is one object that shows all of the fields with the data loaded from the JSON. Can anyone see why the data isn't being read into a new Configuration object and saved to the Configuration store?

    Let me know if I need to post anymore information...

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,797
    Answers
    3467
    Vote Rating
    834
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Try making the configurations property value an object instead of an array in your JSON.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

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

      0  

    Default


    Doing that made it so the configuration showed up as an associated object of the change. But it doesn't load it into the configuration store. Now I'm thinking it's going to be better to load the two stores separately (with flat instead of nested JSON). But will the change objects get automatically associated with their respective configuration objects if the associations definitions are setup correctly on each model? Or is that not a feature built into the framework?

    Quote Originally Posted by mitchellsimoens View Post
    Try making the configurations property value an object instead of an array in your JSON.

Thread Participants: 1

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi