cancel
Showing results for 
Search instead for 
Did you mean: 

FileDownload: combine with onClick?

Former Member
0 Kudos

Hi,

I'm using a FileDownload UI-Element and it works fine. This FileDownload is placed in a popup wich I want to close automatically when the user clicks the FileDownload-Link. But FileDownload has no property like onClick or an eventHandler.

Any idea how to achive this?

Thanks in advance

Jan Hempel

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Silly me.. No request for file download.. so that code wont work.

Extremely sorry.!

And there is no other alternative.

Former Member
0 Kudos

Assuming that file download is the only processing you are doing in the external window..

you can give this a try..

store the window instance in the controller context.. and check if its null in wdDoPostProcessing ..if its not NULL close it.

In wdDoPostProcessing


	/*	check if window instance is created*/
if(wdContext.currentContextElement().getWin()!=null){
	/*	
	*  Check if this request response cycle for creation of Window
	*	If yes , CanDelete is false. Dont delete the window instance.
	*	Initial Value of CanDelete is false.
	*	CanDelete - boolean attribute
	*	win - Attribute which stores window instance
	**/
	if(wdContext.currentContextElement().getCanDelete())
	{
 	 	wdContext.currentContextElement().getWin().close();
		wdContext.currentContextElement().getWin().destroy();
	}
	/*
	 * Set the CanDelete to toggle , so that we can delete it
	 * in the next req-res cycle if it has been created.
	 * 
	**/
	
	wdContext.currentContextElement().setCanDelete(!wdContext.currentContextElement().getTest()); 
 }

.

This is based on the fact when a req- response cycle is carried on and if the window is already created.. the request is because of the click of FileDownload UI. So the window can be closed.

Regards

Bharathwaj

Code added. Bharathwaj

Message was edited by: Bharathwaj R

Former Member
0 Kudos

Hi,

As FileDownload UIE doesnt have any onClick property u cannot trigger an event. The alternative for u can be, to provide a close button in the pop up window.

regards,

Piyush.

Former Member
0 Kudos

Hi Piyush,

I already have a close button, but I wanted to save the user to click that.

Maybe somebody else has an idea/trick?

Thanks and regards

Jan