Results 1 to 3 of 3

Thread: From grid to FormPanel

  1. #1

    Default From grid to FormPanel

    Hi!

    I am trying to set a Listener in Grid so after selecting one Record should get some data and send it to the form.

    But not from the store of the grid. This data is a new one in xml.

    Hier the listener of my grid:

    PHP Code:
    listeners: {
           
    rowselect: function(smrowrec) {
               
                
    Ext.Ajax.request({
                    
    disableCaching false,
                    
    url'form.xml',
                    
    method'GET',
                    
    readerallStoreReader,
                    
    loadMask:true,
                    
    autoLoadtrue,
                    
    remoteSorttrue,
                    
    success: function(resultrequest) {
                        
    Ext.getCmp('form').getForm().loadRecord(result.data.items);
                    }
                });
                
           }
          } 
    But this doesnt work. Please help, im working with this issue for about some days, i will also be glad to have hints if possible

  2. #2

    Default

    With this:

    Ext.getCmp('form').getForm().loadRecord(rec);

    Would be possible te get the records into the form if they are coming directly from the grid but i load a new store after selecting a grid record.

  3. #3

    Default

    I found a solution for this thread. Of course if someone else has something better, i woul be glad to hear


    PHP Code:
    listeners: {
           
    rowselect: function(smrowrec) {
               
                
    Ext.Ajax.request({
                    
    disableCaching false,
                    
    url'form.xml',
                    
    method'GET',
                    
    loadMask:true,
                    
    autoLoadtrue,
                    
    remoteSorttrue,
                    
    success: function(resultrequest) {
                        var 
    text result.responseText;    
            
                         try { 
    // code for IE
                         
    var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
                                        
    xmlDoc.async "true";
                                        
    xmlDoc.loadXML(text);
                                 }catch(
    error) { // code for Mozilla, Firefox, Opera, etc.
                                  
    try {
                                var 
    parser = new DOMParser();
                                var 
    xmlDoc parser.parseFromString(text,"text/xml");
                                 }catch(
    error) {
                                     
    alert(error.message "Data converting failed !");
                                     return;
                                  }
                       var 
    storeReader = new Ext.data.XmlReader({
                                   
    record 'contact'
                                    
    }, [
                                   {
    name'first'mapping:'name/first'}, // custom mapping
                                   
    {name'last'mapping:'name/last'},
                                     
    'company''email''state',
                                  {
    name'dob'type:'date'dateFormat:'m/d/Y'// custom data types
                                                                
    ]);

                                    var 
    myStore = new Ext.data.Store({
                                                        
    dataxmlDoc,
                                                        
    loadMasktrue,
                                                        
    method:'GET',
                                                        
    readerstoreReader,
                                                        
    remoteSorttrue,
                                                        
    autoLoadtrue
                                                    
    });

                                    
                    
    Ext.getCmp('form').getForm().loadRecord(myStore.data.items[row]);
                    
    console.log(myStore.data.items[row]);
                    }
                });
                
           }
          } 
    so the response in text would be translated to xml. after that loaded in the store where i read it and then i send the single items to my form.

Posting Permissions

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