PDA

View Full Version : Editable grid



Radius-Service
20 Aug 2010, 12:36 AM
Hello, I've made editable grid in ext designer. Now i want to add saving of data with ajax. As to me to add this event.

jarrednicholls
20 Aug 2010, 4:57 AM
Hi Radius,

You can query the Store for all records that have been modified since the last commit() call. This can be accomplished this way:



var modifiedRecords = myGrid.getStore().getModifiedRecords();

for (var i = 0; i < modifiedRecords.length; i++){
// ...
}


You can also research the DataWriter class (http://dev.sencha.com/deploy/dev/docs/?class=Ext.data.DataWriter). You can add a writer to your store in the ".js" file, like so:



MyStore = Ext.extend(Ext.data.JsonStore, {
constructor: function(config){
config = Ext.apply(config || {}, {
writer: Ext.data.JsonWriter()
});
MyStore.superclass.constructor.call(this, config);
}
});

// ...

store.save(); // this call will send all modified records to the server via the DataWriter.