Aug 05, 2013, 4:28 PM
None of Success, Failure, or Complete gets called on DirectEvent
I am exporting an Excel file on the click of a button. This is in my View:
This is in my controller:
<ext:Button runat="server" ID="btnExport" Text="Export" StandOut="True" Icon="PageWhitePut" ToolTip="Export to an Excel file" AutoPostBack="False">
<DirectEvents>
<Click Timeout="600000"
IsUpload="True"
OnEvent="ToExcel"
Before="Ext.Msg.wait('Please wait while the report is being generated. This may take a few minutes.', 'Please Wait...');"
Success="Ext.Msg.alert('Success', 'Yay');"
Failure ="Ext.Msg.alert('Error', result.errorMessage);"
Complete="Ext.Msg.alert('Complete', 'Done');">
<ExtraParams>
<ext:Parameter Name="selections" Value="#{GridPanel1}.getRowsValues({selectedOnly:true})" Mode="Raw"/>
</ExtraParams>
</Click>
</DirectEvents>
</ext:Button>
This is in my controller:
protected void ToExcel(object sender, DirectEventArgs e)
{
// get the data...
var eSubmit = new StoreSubmitDataEventArgs(json, null);
System.Xml.XmlNode xml = eSubmit.Xml;
this.Response.Clear();
this.Response.ContentType = "application/vnd.ms-excel";
this.Response.AddHeader("Content-Disposition", "attachment; filename=myfile.xls");
var xtExcel = new System.Xml.Xsl.XslCompiledTransform();
xtExcel.Load(Server.MapPath("Excel.xsl"));
xtExcel.Transform(xml, null, this.Response.OutputStream);
this.Response.End();
}
}
I want to hide the "Ext.Msg.wait" dialog when "ToExcel" finishes, but can't figure out how to do that... "Success", "Failure", and "Complete" never get called so I can't do it in any of those places. What can I do?