ParamQuery grid support forum

General Category => Help for ParamQuery Pro => Topic started by: Pardgroup on September 30, 2015, 02:01:20 pm

Title: Excel/CSV Export Button Callback
Post by: Pardgroup on September 30, 2015, 02:01:20 pm
Greetings,
I'd like to know if the Excel/CSV button has any sort of callback after the download has started or it has been complete.
I need it because sometimes the time for download the excel (or CSV) are long due to long data processing and I'd like to prompt a waiting dialog.

So basically:

Code: [Select]
           
items:  [{
                        type:       'button',
                        label:      'Export to CSV',
                        icon:       'ui-icon-document',
                        listeners: [{
                            click: function (evt) {
                                $("#grid_json").pqGrid("exportCsv", {
                                    url: "script/mypage.php?id="+id,
                                    sheetName: "My Sheet Name",
                                    [b]complete: function(data) {} or success: function(data){} something like that[/b]
                                });
                            }
                        }]
            }]
     

Thanks in advance.
Best, Pardgroup.
Title: Re: Excel/CSV Export Button Callback
Post by: paramvir on October 01, 2015, 01:19:01 pm
Pardgroup

Export process happens in 2 steps:

1. The exported data is posted to the server via AJAX, server saves it and returns the filename.

It's possible to know when 1st step is complete
 
        $( document ).ajaxComplete(function( event, xhr, settings ) {
            debugger;
            if (settings.url == url parameter of export function ){
              alert( 'complete' );
            }
        });

2. The file is downloaded from the server via an iframe.

There is no cross browser way to know when download via 2nd step is complete.

Hope it helps if most of the time is spent in 1st step in your case.


Regards