Search code examples
javascriptextjsextjs3

How to load data from store to Form.Panel?


I have a form.Panel in which I show some data. I receive the data as XML from the server and load it directly into the fields using

podform.getForm().load({url:url_servlet+'kadastr_zemform.jsp' ...

along with a XMLReader.

Now I want to show the data in 3 separate form.Panel. But I just wan't to load the data once before loading it into panels. I guess form.load() no longer works for me in that case.

How would I load the data into several panels? Should I use a store cause I also need to be able to edit the data and send it back?


Solution

  • I find two solutions with store.

    var store = new Ext.data.Store({                
                url: url_servlet+"kadastr_zemform.jsp",
                reader: new Ext.data.XmlReader({
                totalProperty: "results", 
                record: "contact",
                                fields: [
                                        ]})
    });
    store.load();
    
    1. You can use

       podform.getForm().setValues(store.getRange(0)[0].data);
      
    2. Or this:

      var record = store.getAt(0);
      podform.getForm().loadRecord(record);
      

    This answer takken from sencha forum. http://www.sencha.com/forum/showthread.php?248760-How-to-load-data-from-store-to-FormPanel&p=912235#post912235