Results 1 to 3 of 3

Thread: Issue loading json store to form

  1. #1
    Sencha User
    Join Date
    Aug 2011
    Posts
    80
    Answers
    1

    Default Issue loading json store to form

    I have the following code. I'm trying to create the store via json. I can see that firebug calls the json but this data is not loading the form. This is working with a local instance of the of model. So i confident that the panel that contains "formJobSummary" is working. The issue is somewhere on the store.

    Code:
    Ext.define('user', {    extend: 'Ext.data.Model
        fields: ['quotedPrice']
    });
    var store = Ext.create('Ext.data.Store', {
        model: 'user',
        proxy: {
            type: 'ajax',
            url: '/data/users.js',
            reader: {
                type: 'json',
                root: 'user'
            }
        },
        autoLoad: true
    });
    
    
    
    
    Ext.define('MyApp.view.MyPanel', {
        extend: 'MyApp.view.ui.MyPanel',
        initComponent: function () {
            var me = this;
            me.callParent(arguments);
            var form = Ext.getCmp('formJobSummary'); 
            form.loadRecord(store);
        }
    });

    Json '/data/users.js'

    Code:
    {    "success":"true",
        "user": [{
            "quotedPrice":"12345"
        }]
    }

  2. #2
    Sencha User tobiu's Avatar
    Join Date
    May 2007
    Location
    Munich (Germany)
    Posts
    2,751
    Answers
    130

    Default

    http://docs.sencha.com/ext-js/4-0/#!...hod-loadRecord

    expects a record as a parameter, you are passing the store instance instead.
    Best regards
    Tobias Uhlig

  3. #3
    Sencha User
    Join Date
    Aug 2011
    Posts
    80
    Answers
    1

    Default

    thanks, so i think that means i need to do something like.

    var form = Ext.getCmp('formJobSummary');
    form.loadRecord(user);

    Sorry to be dumb, do you mind expanding on this a little.

Posting Permissions

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