Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Manoj_Prabu
Partner - Creator
Partner - Creator

How to create a delay for exporting to image option, so that my UI render completely while downloading?

Hi Community,

In my extension, I'm using an API call to fetch some details from other service and render the different UI based on the response. The issue is when I try to export as image, Qlik sense rendering before my UI gets rendered. 
I tried to setTimeout for the qlik.promise.resolve and I also tried to use qlik.promise.defer to delay the export functionality. Still I couldn't able to render the UI in the image.

Any information is appreciated. Please reply incase of additional information is required.

Thanks,
Manoj

Labels (3)
1 Solution

Accepted Solutions
Manoj_Prabu
Partner - Creator
Partner - Creator
Author

Hi Community,

I found the solution for the issue. we just need to create a delay until the API call is completed.

var Promise = qlik.Promise;
				return new Promise(function (resolve, reject) {
					setTimeout(function () {
						resolve(); // Extension painted successfully
					}, 1000);
				});

I just used the above code instead of 

return qlik.Promise.resolve();

Simply set the time out to 1 sec. (it may cause issue if the API call exceed 1 sec to complete).

Note: Once we included the code, restart the Qlik Printing service. Without restart, it may produce the result based on the previous state which means even if we change the code, it still produces blank page.

View solution in original post

3 Replies
PadmaPriya
Support
Support

Hi @Manoj_Prabu 

 

Are you talking about downloading the image, if so refer to below link:

https://help.qlik.com/en-US/sense/February2023/Subsystems/Hub/Content/Sense_Hub/Printing/exporting-v...

 

Also please be more specific about the requirement so we can move in right directions.

 

Thanks,

Padma Priya

Qlik Support

Help users find answers! Don't forget to mark a solution that worked for you! If already marked, give it a thumbs up!
Manoj_Prabu
Partner - Creator
Partner - Creator
Author

Hi @PadmaPriya ,

Thanks for the response. Yes, you are right. I'm talking about the export as image, pdf option that available in the context menu.

For the understanding, I'm developing a Qlik sense extension, where I'm using fetch API to get some data from our service, based on which I'll render the UI. There is no issue with the UI, as it gets rendered once it fetches the data from the API service. But when I try to export it as image/pdf, Qlik render the image even before my UI gets rendered. So, it coming as blank. If I remove the API call, then the image is rendering as expected.

Table as Object:

Table as ObjectTable as Object

 

 

 

 

 

 

The Exported Image just have nothing. 
I referred to the below link to wait until my UI get rendered, but still, I didn't get it properly in the exported image.
promise object | Qlik Sense for developers Help

Whereas the export to data is working properly as it has nothing to do with the UI.
Please let me know any specific kind of information is required.

Thanks,
Manoj

Manoj_Prabu
Partner - Creator
Partner - Creator
Author

Hi Community,

I found the solution for the issue. we just need to create a delay until the API call is completed.

var Promise = qlik.Promise;
				return new Promise(function (resolve, reject) {
					setTimeout(function () {
						resolve(); // Extension painted successfully
					}, 1000);
				});

I just used the above code instead of 

return qlik.Promise.resolve();

Simply set the time out to 1 sec. (it may cause issue if the API call exceed 1 sec to complete).

Note: Once we included the code, restart the Qlik Printing service. Without restart, it may produce the result based on the previous state which means even if we change the code, it still produces blank page.