1. #1
    Sencha User
    Join Date
    Aug 2009
    Posts
    15
    Vote Rating
    0
    jankshtt is on a distinguished road

      0  

    Default extJS grid, data update problem.

    extJS grid, data update problem.


    Hi,

    I am creating a grid which connects to database through jsp. I want to process the changes at once and not one by one. I want to add new records, update some and remove some and all these changes must be processed once I click on save button. So far I could understand the sample code from examples. please help me understand or provide with some example where I can process the entire changes at once. I really appreciate if any one can help.

    Thanks & Regards,
    jankshtt

  2. #2
    Sencha User
    Join Date
    Aug 2009
    Posts
    15
    Vote Rating
    0
    jankshtt is on a distinguished road

      0  

    Default


    This is what I have come up with( from different examples) can any one please guide me as how to proceed. Thank you very much for any help/ sugessions


    When I click save button I want to send the json string of the current store and update it at the server side.

    When I click cancel i want to refresh the data from the server.

    Code:
    buttons: [
         
         {text:'Save',
         
                  fn: function(btn){
                    if (btn == 'yes'){
                         var conn = new Ext.data.Connection();
                        conn.request({
                        url: 'recordUpdate.jsp',
                        
                        params: {
                        action: 'delete',
                        id: e.record.id
                                   },
                        success: function(resp,opt) {
                        grid.getStore().remove(sel);
                            },
                        failure: function(resp,opt) {
                        Ext.Msg.alert('Error','Unable to delete the record');
                                     }
                                
                                });
                            }
                        }
         
         },{text:'Cancel'}],
                buttonAlign:'center',

  3. #3
    Sencha User
    Join Date
    Aug 2009
    Posts
    15
    Vote Rating
    0
    jankshtt is on a distinguished road

      0  

    Default


    This is what I have come up with ( from different examples). Please tell me how to go about from here. Is this the correct code?? please explain how to work with it .

    Code:
     buttons: [
         
         {text:'Save',
         
                  handler: function(){
                
                         var conn = new Ext.data.Connection();
                        conn.request({
                        url: 'recordUpdate.jsp',
                        
                        params: {
                        data: jsonEncodeStore,
                        action: 'update',
                        method : 'POST'
                    //    id: sel.record.id
                                   },
                        success: function() {
                        grid.getStore().remove(sel);
                        grid.getView().refresh();
                            },
                        failure: function() {
                        Ext.Msg.alert('Error','Unable to process the changes, PLEASE START OVER');
                        grid.getView().refresh();
                                     }
                                
                                });
                        
                        }
         
         },{text:'Cancel'}],
                buttonAlign:'center',
    where jsonEncodeStore is

    Code:
    var jsonEncodeStore = function(store){
        var data_array = [];
        store.each(function(store){
            data_array.push(store.data);
        });
        return Ext.util.JSON.encode(data_array);
    };

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..."