PDA

View Full Version : Direct Event with IsUpload doesnt fire Success



Z
Jun 09, 2020, 8:54 AM
I am using this button to UPLOAD an excel file, modify it and then return it to the user via MVC FileResult (byte[]) in one shot. However, Success is never called. If i change it to After, it works.
thanks!
/Z



<ext:Button ID="XlsSaveButton" runat="server" Text="Run Report" Disabled="true">
<DirectEvents>
<Click
Url="/ta/XXXX/RunXXX"
Timeout="60000"
IsUpload="true"
CleanRequest="true"
Method="POST"
Before="Ext.net.Mask.show();"
Success="alert('Your file will be downloaded shortly');"
Failure="Ext.Msg.show({
title: 'Error',
msg: result.message || result.errorMessage,
buttons: Ext.Msg.OK,
icon: Ext.MessageBox.ERROR
});">
<EventMask MinDelay="250" />
</Click>
</DirectEvents>
</ext:Button>

fabricio.murta
Jun 10, 2020, 1:11 AM
Hello Zev!

I'm afraid the IsUpload setting limits direct events in regard to the aspect you want to explore due to the nature uploads works in browsers.

Instead, you may tie the After event to the direct method to query the server (again) and check if the upload proceeded accordingly. Then you'd be able to enjoy the proper event's responses, as well as being able to further check the upload for consistent data, etc.

Here's a thread about this issue that may help a bit: DirectEvent isUpload=true block other actions (https://forums.ext.net/showthread.php?53101)

Hope this helps!