cancel
Showing results for 
Search instead for 
Did you mean: 

How to programatically execute download event

Former Member
0 Kudos

HELLO.

I want to add download functionality to my web dynnpro app. All examples shows that I must generate ByteArray in the wdInit method. The problem is that it is a lot of files and I dont want to generate them all on view init. I want to generate the byte array after choosing donwload option. How can I achieve it ?

Thanks in advance

LUKAS

ps. there is no option to set onAction on download file component. it autommatically download binded ByteArray

without possibility to execute any line of code before it.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Thank You . That was it

Former Member
0 Kudos

Hi,

create a button or link and add the following code to its action handler:


final byte[] data = ...;
final IWDCachedWebResource resource = WDWebResource.getWebResource(data, WDWebResourceType.<MIME_TYPE>);
try {
	final IWDWindow window = wdComponentAPI.getWindowManager().createExternalWindow(resource.getAbsoluteURL(), "Title", false);
	window.open();
} catch(Exception e) {
	wdComponentAPI.getMessageManager().reportException(new WDNonFatalException(e), false);
}