PDA

View Full Version : [CLOSED] Problem on success/failure return from a directMethod



feanor91
Sep 30, 2013, 12:26 PM
Hello

I have a directMethod that I used to create an Excel file that I return from my method throught a Response object like that :



Response.ClearHeaders()
Response.AddHeader("content-disposition", "attachment; filename=" + xlsFileName)
Response.ContentType = "application/xls"
Response.WriteFile(Server.MapPath("~/xlsFiles/") + xlsFileName) 'return document
Response.End()


As computation take some time in code behind, I have decided to show a mask :



var callExcelComputation = function () {

maskOnLoad("Calcul en cours...", 'wndToMask');

App.direct.callExcelComputation ( {sucess: hideMask, failure: hideMask, isUpload: true });

}

var hideMask = function () {
unmaskOnLoad('wndToMask');
}

It works well to put the mask, of course, but the sucess/failure function is never called, so I'm stuck with the mask on the screen :(

I think it can be related to the isUpload: true, that did not return corectly the sucess/failure thing, but found no way, until now, to make the things worked.

Daniil
Sep 30, 2013, 1:34 PM
Hi @feanor91,

So, you download a file via AJAX. Unfortunately, there is a limitation - it doesn't fire success/failure events.

Generally speaking, there is no way to overcome it. Though, there is some trick that can be helpful and good enough in some scenarios.
http://forums.ext.net/showthread.php?19430&p=83757&viewfull=1#post83757

Or, certainly, you can use, for example, Flash for downloading.

feanor91
Sep 30, 2013, 2:04 PM
That was what I thought...

I will look at your example, thanks.