Sign in to follow this  
geebee

Show Loading Gif While Waiting On Printmanager

Recommended Posts

Can you please help me with coding the following:

 

I use a jQuery UI dialog to show a loading.gif when page is busy loading or processing.

 

This is the code to open dialog:

 

$("#dialog-Loading").html("<img class='loader-img-dialog' src='../images/ajax-loader2.gif'/><span class='loader-text'>"+ _pleaseWait +"...</span>").dialog('open');

 

This is the code once the page loads to clos dialog

 

$(window).load(function() {

$('#dialog-Loading').dialog('close');

});

 

*********************************************************************

 

I have this jQuery function when user clicks on "Print" button to print chart:

 

$("#jPrint").live('click',function(){

 

$("#dialog-Loading").html("<img class='loader-img-dialog' src='../images/ajax-loader2.gif'/><span class='loader-text'>"+ _pleaseWait +"...</span>").dialog('open');

 

FusionCharts.printManager.managedPrint();

 

});

 

*****************************************************************************************************************

 

The dialog comes up and stays up even after the printManager dialog is finally displayed.

Can you help me code the --- $('#dialog-Loading').dialog('close'); --- so that the loading.gif will close when printManager is done?

Share this post


Link to post
Share on other sites
Guest Angshu

Hi,

 

Thanks for your reply.

 

We are looking into the issue and will get back to you once we come up with a solution.

 

Thank you very much for your continued patience and patronage.

 

Hope you have a great day!

Share this post


Link to post
Share on other sites

Hi,

 

You can raise an event when the Print Manger starts processing of all the charts to make them ready for printing. The same event is raised when Print Manger is ready with all the charts processed for printing.

 

You can trap this event like this:

 

FusionCharts.addEventListener ( 
         FusionChartsEvents.PrintReadyStateChange , 
         function (identifier, parameter) {
           if(!parameter.ready){ 
                      // raised first time               
                     alert("Print Manger started");
                   document.getElementById('printButton').disabled = true;
           }
            else
            {
                      // raised second time               
                     alert("Chart is now ready for printing.");
                   document.getElementById('printButton').disabled = false;

            }
       });

 

So you can add your code lines in any of these scopes.

 

However, please note that once the Print Manger is ready it will not raise any other event when actual print is complete.

 

That you would need to track using browser's native events.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this