Jan 20, 2010, 7:29 PM
[0.8.2] Error Getting AjaxMethod Value
Hey all,
I'm using a codebehind process for modifying the dataObject before saving, deleting and inserting.
For that I pass the record from the ProductsStore to the codebehind as a parameter.
I'm using also a Function (CheckData) to commit the Data Changes before the event
For testing, I'm using MessageBox to show the entity.
My problem is that I cannot get the updated data in the codebehind directly.
For example, if I change the ProductName in the formPanel, I cannot get this modified data only if I click another time the saveBtn
Here you are the scenario :
1) I change the product name YYYY to XXXX.
2) I click Save
3) The product name passed to the codebehind is YYYY
4) I click save again
5) The product name passed to the codebehind is now XXXX
So, what's wrong ?? I checked the ProductsStore.getRecordsValues with FireBug. It return the productName XXX during the first click.
Thanks again for you help.
I'm using a codebehind process for modifying the dataObject before saving, deleting and inserting.
For that I pass the record from the ProductsStore to the codebehind as a parameter.
I'm using also a Function (CheckData) to commit the Data Changes before the event
var CheckData = function () {
if (!#{FormPanel1}.getForm().isValid()) {
return false;
}
#{FormPanel1}.getForm().updateRecord(#{ProductsStore}.getAt(0));
#{ProductsStore}.commitChanges();
return true;
}
For testing, I'm using MessageBox to show the entity.
protected void MenuItem7_Click(object sender, AjaxEventArgs e)
{
Ext.Msg.Alert("AjaxEvent", string.Format("Item - {0}", e.ExtraParams["ProductEntity"])).Show();
}
<ext:ToolbarButton ID="BtnSave" runat="server" Icon="Disk" Text="Enregistrer">
<AjaxEvents>
<Click OnEvent="MenuItem7_Click" Before="CheckData()">
<ExtraParams>
<ext:Parameter Name="ProductEntity" Value="#{ProductsStore}.getRecordsValues()"
Mode="Raw" Encode="true" />
</ExtraParams>
</Click>
</AjaxEvents>
<ToolTips>
<ext:ToolTip ID="ToolTip7" runat="server" Html="enregistrement." />
</ToolTips>
</ext:ToolbarButton>
My problem is that I cannot get the updated data in the codebehind directly.
For example, if I change the ProductName in the formPanel, I cannot get this modified data only if I click another time the saveBtn
Here you are the scenario :
1) I change the product name YYYY to XXXX.
2) I click Save
3) The product name passed to the codebehind is YYYY
4) I click save again
5) The product name passed to the codebehind is now XXXX
So, what's wrong ?? I checked the ProductsStore.getRecordsValues with FireBug. It return the productName XXX during the first click.
Thanks again for you help.