Results 1 to 4 of 4

Thread: no data in formpanel

  1. #1
    Ext JS Premium Member
    Join Date
    Feb 2010
    Posts
    19

    Smile no data in formpanel

    Hi,

    i have a new formpanel. after loading the data, they will not be displayed in the formpanel.
    Here is my code:

    Code:
    MyPanel2Ui = Ext.extend(Ext.FormPanel, {
        id: 'MyPanel2UiID',
        title: 'Tab 3',
        layout: 'form',
        frame: true,
        initComponent: function() {
            this.items = [
                {
                    id:'anr',
                    xtype: 'displayfield',
                    fieldLabel: 'Field A',
                    name: 'anr',
                    anchor: '95%' 
                },
                {
                    xtype: 'displayfield',
                    fieldLabel: 'FIELD B',
                    name: 'id',
                    anchor: '100%'
                },
                {
                    xtype: 'displayfield',
                    fieldLabel: 'FIELD C',
                    name: 'sponsor',
                    anchor: '100%'
                }
            ];
            MyPanel2Ui.superclass.initComponent.call(this);
            
            this.on({
                render: {scope: this, fn: function(){
                    Ext.getCmp('MyPanel2UiID').getForm().load({  
                        url:'data/json-propdata.php',
                        params:{xaction: 'read', propID: 1}, 
                        waitMsg: 'Loading...',
                        loadMask: true
                    })
                 } }       
            });
        }
    });
    And the recieved data:

    Code:
    {success: true, data: [{'anr':'123-45-ABC','id':1718,'sponsor':'Cats - Dogs Ltd.'}]}
    Can someone explain my why? And support my to find a solution?

  2. #2
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,245

    Default

    This JSON data doesn't match the expected format.

    Either change the JSON data ('data' should be an object and not an array) or specify a 'reader' in the form to handle this kind of data.

  3. #3
    Ext JS Premium Member
    Join Date
    Feb 2010
    Posts
    19

    Default

    Now i have changed the JSON fomat to

    Code:
     {"success":true,"data":[{"angebotsnummer":"378-09-REACh.1","id":"1124","sponsor":"BRUNO BOCK "}]}
    but the result ist the same. Now i will try an arrayreader.

  4. #4
    Ext JS Premium Member
    Join Date
    Feb 2010
    Posts
    19

    Default

    i solved the problem. it was a wrong JSON format, but JSONlint has validated my result.

    the right JSON format is

    Code:
     
    {'success':'true','data':{'anr':'123-45-ABC','id':1718,'sponsor':'Cats - Dogs Ltd.'}}

Similar Threads

  1. Loading data to FormPanel with tabs. No data displays in fields.
    By santail in forum Ext 2.x: Help & Discussion
    Replies: 5
    Last Post: 24 Oct 2009, 8:04 PM
  2. Replies: 8
    Last Post: 24 Aug 2009, 7:43 AM
  3. Send data in formpanel works, how to load the data?
    By Gunmen in forum Ext 2.x: Help & Discussion
    Replies: 17
    Last Post: 13 Mar 2009, 2:51 AM
  4. Update FormPanel Data
    By beatlecesar in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 17 Jan 2008, 8:01 AM
  5. Replies: 3
    Last Post: 9 Nov 2007, 3:30 AM

Posting Permissions

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