Results 1 to 2 of 2

Thread: Load Data to Form (JSON)

  1. #1
    Sencha User
    Join Date
    Mar 2014
    Posts
    3

    Default Load Data to Form (JSON)

    Hello everybody! I need your help!

    I have a FormPanel in extjs 3.4 and I want to load data from seerver via a webservlet but I am a bit confused.

    The webservlet responses with the following JSON information:
    {"items":{"address":"1","email":"[email protected]","lastname":"aaa","firstname":"olia"},"success":true}

    I tried two ways:
    A. After layout.setActiveItem('FormPanellID'); I
    I used:
    FormPanel .getForm().load({ url: 'servletURL',
    failure: function(form, action) {
    Ext.Msg.alert("Load failed", action.result.errorMessage);
    }
    });

    but I get the failed message!

    B. I create a new Ext.data.JsonStore
    var panelStore = new Ext.data.JsonStore({ autoLoad: true,
    autoDestroy: true, url : 'servletURL',
    root: 'items',
    fields: [' 'email', 'firstname', 'address', 'status', 'lastname', ''],
    listeners : {
    load: function(store, records, options){
    if(records[0]){
    FormPanel.getForm().loadRecord(records[0]);
    } else{
    console.log("no data!");
    }
    }
    }
    });


    and then I call panelStore .load();
    but nothing happens!

    I try 5 days to load data to a form but nothing! I thought that extjs was not too difficult
    Could you please help me?

  2. #2
    chramer's Avatar
    Join Date
    Feb 2011
    Location
    Chisinau, Moldova
    Posts
    316
    Answers
    64

    Default

    'root' property should be applied to reader, not to store..
    Check the example from the docs: http://docs.sencha.com/extjs/4.2.2/#...data.JsonStore

Posting Permissions

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