1. #1
    Sencha Premium Member
    Join Date
    Dec 2011
    Posts
    236
    Vote Rating
    3
    ypandey is on a distinguished road

      0  

    Default Store.load callback function problem

    Store.load callback function problem


    I am using the following snippet in my code:

    Code:
            store.load({
                params:{paramMap},
                callback : function(records, options, success) {
                    if (success) {
                        var form = formPanel.getForm();
                        var jsonStr = Ext.JSON.encode(records[0].raw);
                        var jsonObj = Ext.JSON.decode(jsonStr);
                        form.loadRecord(jsonObj);
                    }
                }
            });
    This retrieves data passed from the server in JSON format and loads it into the form panel.
    The callback function loads records with raw data. The data fields remain empty. Hence i have to use encode and decode to get the records in the right format.
    Please help me in understanding why the records raw data is populated and not the data.
    Am i going wrong somewhere??

    Thanks
    Rabi
    Last edited by mitchellsimoens; 12 Mar 2012 at 6:40 AM. Reason: added [CODE] tags

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,525
    Vote Rating
    871
    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


    loadRecord is expecting a model instance not an object
    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 Premium Member
    Join Date
    Dec 2011
    Posts
    236
    Vote Rating
    3
    ypandey is on a distinguished road

      0  

    Default


    loadrecord() works fine above...the doubt i have is regarding records[0].raw.
    The records data should be populated, but i can only see raw data populated

    Help

Thread Participants: 1