View Full Version : RowEditor: how to refresh row data from database before editing

Sep 29, 2010, 2:29 PM

I am using a gridpanel with the roweditor plugin and I need to refresh the data of the row being edited from the database just before switching into "editing mode". What is the best way to do this ?

I tried with a DirectMethod on the server which returns the new row data and a Listener hooked at BeforeEdit event of the row editor yet it does not work since the DirectMethod is asynchronous and the row editor goes into editing mode before the new row data returns.

Is it possible in some way to issue a synchronous DirectMethod (XmlHttpRequest provides this features so I hope it is possible in some way) ?

Thank you in advance.


<ext:RowEditor ID="RowEditor2" runat="server" SaveText="Update" >
<BeforeEdit Fn="rowEditorBeforeEdit" />

var rowEditorBeforeEdit = function (el,rowindex) {
var store=el.grid.store;
var record=store.getAt(rowindex);

Ext.net.DirectMethods.mhwStore_UpdateRow(record.da ta.MhWebAdditionalDataId, {
success: function(result) {

// el.startEditing(rowindex); // this does not work since an endless event loop is generated

failure: function(result) {
Ext.Msg.alert('Failure', 'Error occurred during refreshing row from database' + result);

// return false; // this does not work since an endless event loop is generated

Server (.cs):
public object mhwStore_UpdateRow(int mhWebAdditionalDataId)
// fetches and returns new data from database