• Home
  • [Solved] Formpanel, JsonReader and databinding

  • Hi,

    I have tried to get the databinding feature to work between the FormPanel and the Jsonreader - without luck and I have absolutely no idea why this does not work..

    When I Press the load button the request is getting fired and the result is returned as expected from the service - but the formfields does not get populated???

    FormPanel definition: (Some config options has been omitted..)

    productForm = new Ext.FormPanel({
    defaultType: 'textfield',
    waitMsgTarget: true,
    success: 'success',
    reader: new Ext.data.JsonReader(
    {
    root: 'GetProductResult',
    fields: ['Id','Name', 'Currency']
    }
    ),

    items: [{
    fieldLabel: 'Product Name',
    name: 'Name'
    },{
    fieldLabel: 'Currency',
    name: 'Currency'
    }]
    });

    productForm.addButton('Load', function(){
    productForm.getForm().load({url:'service1.svc/GetProduct', method: 'Get', waitMsg:'Loading..',success:successHandler});
    });


    JSON returned from the server
    {"GetProductResult":{"data":{"Currency":"£","Name":"SomeName","success":true}}


  • Wauw - thanks for the quick response :-)

    Works like a charm !!!

    Regards Morten


  • Don't use a Reader, there's no point. FormPanels understand JSON anyway.

    And then the response should be


    { success: true, data: {Currency: '£', "Name" :"SomeName"}}







  • #If you have any other info about this subject , Please add it free.#
    Your name:
    E-mail:
    Telphone:

    Your comments:


    If you have any other info about [Solved] Formpanel, JsonReader and databinding , Please add it free.