View Full Version : beginner try to save content of a editable grid

23 Apr 2009, 3:54 AM
could someone tell how to save the content of an editable grid to the xml, once modified.
Thanks in advance.


25 Jan 2010, 2:34 PM
One of the ways is:

function saveGrid(grid){
var records = grid.store.getModifiedRecords(); //gets the modifieds records
var data = [];
records.each(function(r){ //Gets the data of each record
data = Ext.encode(data); //transform object into a string

Ext.Ajax.request (http://www.extjs.com/deploy/dev/docs/output/Ext.data.Connection.html#Ext.data.Connection-request)({ //send the data to remote script.
url: 'save.php',
success: someFn,
failure: otherFn,
params: { data: data }


In remote script, you need decode the data:

$data = json_decode($_POST['data']);

If records has accents, before json_decode you will need to use utf8_decode function in $_POST['data'].

The other way is use DataWriter components, but yet I not used it.