1. #1
    Ext User
    Join Date
    Apr 2009
    Location
    Brussels
    Posts
    6
    Vote Rating
    0
    Ahava is on a distinguished road

      0  

    Question GridPanel - "Persist" all the data

    GridPanel - "Persist" all the data


    Hello,

    I'm asking for a little bit of help (@ Ext 2.2.1).


    I would like, in a grid that has loaded data, "persist" all the modification done to the data in this grid.


    I need that because I have a formPanel, and a part of the data represented by this formPanel is a list. So I would like to be able to save the form and the modification done to the list within a single request !


    I did that in the past by having a div in a <form> in the HTML page, and by generating (with jquery) hidden inputs for each row in the list. I wonder if there is a clean solution to do that, with a FormPanel.


    To do that, I need those information :
    • The new elements (easy to do -> negative id)
    • The modified elements (flag or something?)
    • The deleted elements (?)
    What is the right way to do that ?

    Thank you a lot for your help !

  2. #2
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,251
    Vote Rating
    73
    Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold

      0  

    Default


    Does it really need to be a form? Can't you use a simple XHR request?

    Something like:
    Code:
    var data = [];
    Ext.each(store.getModifiedRecords(), function(r){
      data.push(r.data);
    });
    Ext.Ajax.request({
      url: '...',
      jsonData: data,
      success: function(){
        store.commitChanges();
      },
      failure: function(){
        store.rejectChanges();
      }
    });
    For deleted records there is a trick:
    Instead of deleting the record set a field ('status'?) in the record to 'deleted' (and for new records set the status to 'added').
    Next, in the grid viewConfig write a getRowClass that returns a css class for deleted records with a display:none css rule (this will hide the row).

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar