Hi,

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.

Federico.

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

Javascript:
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) {
record.beginEdit();
record.data=result;
record.commit();
record.endEdit();

// 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):
[DirectMethod]
public object mhwStore_UpdateRow(int mhWebAdditionalDataId)
{
// fetches and returns new data from database
}