Results 1 to 3 of 3

Thread: Store.load callback function problem

  1. #1
    Sencha User
    Join Date
    Dec 2011
    Posts
    242
    Vote Rating
    6
      0  

    Default 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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,556
    Vote Rating
    1272
      0  

    Default

    loadRecord is expecting a model instance not an object
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  3. #3
    Sencha User
    Join Date
    Dec 2011
    Posts
    242
    Vote Rating
    6
      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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •