[CLOSED] Problem with DirectEvent function and response object

  1. #1

    [CLOSED] Problem with DirectEvent function and response object

    Hello

    I have a DirectEvent fucntion called on a button click.

    My function takes data from a grid and return them as an excel files through a response object like that :

            
            Response.Clear()
            Response.Buffer = True
            Response.AddHeader("Content-Disposition", "attachment;filename=" + FileName + " Export.xls")
            Response.ContentEncoding = System.Text.Encoding.Default
            Response.ContentType = "application/vnd.ms-excel"
    
            Response.Write(GenHtmlTable(grd, WindowTitle)) 'here the magic (see below) <---this line generate excel file (kind of)
    
            Response.End()
    The problem occurs when I want to unmask client window that makes the call, I can't do that after response object :

            Ext.Net.X.Call("unMaskOnLoad", "myWindow")
    neither I can use Success property od direct event call like that :

    <DirectEvents>
        <Click OnEvent="ExportGridToExcel" Success="unMaskOnLoad('wndSpareListStock')">
            <ExtraParams>
                <ext:Parameter Name="data" Value="#{grdSpareListStock}.getRowsValues({selectedOnly : false})" Mode="Raw" Encode="true"></ext:Parameter>
                <ext:Parameter Name="Grid" Value="grdSpareListStock" Mode="Value" Encode="False"></ext:Parameter>
            </ExtraParams>
        </Click>
    </DirectEvents>
    <Listeners>
        <Click Handler="maskOnLoad('Please wait...','wndSpareListStock')"></Click>
    </Listeners>
    Could it be a workaround to such behavior?
    Last edited by Daniil; Sep 29, 2015 at 5:42 PM. Reason: [CLOSED]
  2. #2
    Hi @feanor91,

    So, that is downloading via an AJAX request. Unfortunately, there is no way to get Ext.Net.X.Call(...); working with such a request. A server sends a file and that is it.

    As for a Success handler, it is a very unfortunate limitation of downloading via AJAX - no success/failure events. Actually, there is no way to determine that downloading is finished and then hide a mask.

    There is some approach that is useful in some scenarios. Maybe, it can help you as well.
    http://forums.ext.net/showthread.php...ll=1#post83757
  3. #3
    Hi,

    It is that I was affraid of...I will look at the link.

    Thanks.
  4. #4
    Hi,

    I found a solution with link helps.

    Thanks a lot
  5. #5
    Great to hear! Thank you for sharing that.

Similar Threads

  1. Replies: 4
    Last Post: Oct 27, 2012, 10:59 AM
  2. Replies: 0
    Last Post: Aug 05, 2012, 10:46 AM
  3. Replies: 1
    Last Post: Jun 27, 2012, 9:19 PM
  4. [CLOSED] Can I use Response object in a direct method call?
    By feanor91 in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Jun 12, 2012, 11:50 AM
  5. [CLOSED] "'Ext.Net.Response' is null or not an object" on store save
    By bryantharpe in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Apr 22, 2010, 7:06 PM

Posting Permissions