Search code examples
jspextjsextjs3

how to pass modified recors of grid store to jsp page in extjs


I have created a editor grid panel in that i have edited the data and i stored the modified records in array, how to pass those records to jsp page to update in database

            function modifycheckpoints(){
     var updateddata =new Array(); 
     updateddata.push(checkpoint.getModifiedRecords());
       Ext.Ajax.request({   
          url: 'update_checklist.jsp',
          params: {             
                     updatedcheckpoint: updateddata
                              }, 
          success: function(response){                          
             Ext.Msg.alert("Result","Data modified successfully");
             checkpoint.reload();
          },
          failure: function(response){
              Ext.MessageBox.alert('Error','could not connect to the database. retry later');       
          }                                     
       });   
      }
     });

i have tried like that but i am not getting data in jsp page could please help me


Solution

  • we need to encode the modified records before sending

    var updateddata = myGrid.getStore().getModifiedRecords();
            var ch = new Array();
    
            for (var i = 0; i < updateddata.length; i++) {
    
                ch.push(updateddata[i].data);
    
            }
            ch = Ext.encode(ch);
    

    after encoding we will get data as json string