cancel
Showing results for 
Search instead for 
Did you mean: 

close the pop-up window

Former Member
0 Kudos

Hi all,

i hv to close the window that appears on click of a button .

i hv a button 'close' in the popup window with the following code:

IWDWindowInfo win = wdComponentAPI.getComponentInfo().findInWindows("Address_Win");

IWDWindow window = wdComponentAPI.getWindowManager().createWindow(win,true);

window.destroy();

it shows no action..

can u plz tell me why is it so and what is the correct way to do it?

Thanks and Regards,

Ankita

Accepted Solutions (0)

Answers (6)

Answers (6)

nikhil_bose
Active Contributor
0 Kudos

hi ankita,

IWDWindowInfo win = wdComponentAPI.getComponentInfo().findInWindows("Address_Win");

IWDWindow window = wdComponentAPI.getWindowManager().createWindow(win,true);

window.destroy()

This code creates another window instance, it will not refer the current one. so can't be closed.

sol:

Create another attribute in the popwindow view and in master view of type(com.sap.tc.webdynpro.services.session.api.IWDWindow) IWDWindow (say CurrentWindowInstance) and pass that instance to popwinodow.

onAction create popup window


}
IWDWindowInfo win = wdComponentAPI.getComponentInfo().findInWindows("Address_Win");
IWDWindow window =(IWDWindow) wdComponentAPI.getWindowManager().createWindow(win,true);
wdContext.currentContextElement().setCurrentWindowInstance( window);
window.show();

now you can destory the current instance by


wdContext.currentContextElement().getCurrentWindowInstance().destroyInstance();

nikhil

Former Member
0 Kudos

Hi ,

Create a Value Attribute of type com.sap.tc.webdynpro.services.session.api.IWDWindow in generating view ,popup views and Controller and map them accordingly.

Now on close action of popup view - use this code

IWDWindow win = wdContext.currentContextElement().getWindow();

win.destroy();

Regards,

Sunitha Hari

Former Member
0 Kudos

OnAction() close window write this code


wdContext.current<value node>Element().get<value attribute>().destroyInstance();

Where value attribute is of java type IWDWindow.

This is compete code for popup window


To Open Window
*****************

IWDWindowInfo info = wdComponentAPI.getComponentInfo().findInWindows("Popup");
    IWDWindow wind = wdComponentAPI.getWindowManager().createModalWindow(info);
    wind.setTitle("Value Help Window");
    wind.setWindowPosition(150,150);
    wind.setWindowSize(150,150);

    wdContext.currentContextElement().setValueHelpWindow( wind);

    wind.show();
********************************************************************
To Close Window
****************

IWDWindow windwow = (IWDWindow)wdContext.currentContextElement().getValueHelpWindow();
	windwow.destroyInstance();

Mandeep Virk

Former Member
0 Kudos

Hi

In component controller you create one method and variable like follows

i.e., close window, modalwindow.

//@@begin others

IWDWindow modalwindow;

//@@end

}

public void closewin( )

{

//@@begin closewin()

modalwindow.destroyInstance();

//@@end

}

and then call this method to specific button by follows

wdThis.wdGetJPopupCompController().closewin();

try this and let me know

Thanks ,

Tulasi.Palnati

Former Member
0 Kudos

Thanks all,

bt i hv created all the nodes and attributes dynamically...

hence i cud nt write the given codes..

i am also nt able to get window instance..

Regards,

Ankita

Former Member
0 Kudos

OnAction() close window write this code


wdContext.current<value node>Element().get<value attribute>().destroyInstance();

Where value attribute is of java type IWDWindow.

Mandeep Virk

Former Member
0 Kudos

Hi,

For this you need to have a context attribute of type IWDWindow. when you create the window just set the window instance to this attribute.

Say your attribute is "PopupWin". Now on close you can write:


IWDWindow win = wdContext.currentContextElement(),getPopupWin();
win.destroyInstance();

Just check the following link for further clarity:

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/42af9f90-0201...

thanks & regards,

Manoj