PDA

View Full Version : writer: Preventing saves of already saving data



Tim Toady
28 Oct 2010, 9:23 AM
Hello,

When using an editor grid and values are entered quickly, each POST also contains the value of the previous record updates which are currently in the process of saving. I would rather it not do this so I made this attempt to fix it but I am getting an error. How can I do this correctly?



beforeSave: function() {
if(Ext.Ajax.isLoading()) {
setTimeout(this.save, 1000);
return false;
}
}
uncaught exception: Ext.data.Store: Attempted to execute a write-action without a DataWriter installed.

Edit----------------------------
Instead of calling this.save I called this.testing and console logged its "this" reference. "this" is set to the window. It wont accept setTimeout(params).call(ref) either

Solved-----------------------------------------------------


beforeSave: function() {
if(Ext.Ajax.isLoading()) {
var store = this;
setTimeout(function(){store.save()}, 1000);
return false;
}
}

Any suggestions of a better way to solve this issue are welcome