cancel
Showing results for 
Search instead for 
Did you mean: 

How to close a popup?

Former Member
0 Kudos

Hi,

Im having a button, on the click of the button i'm opening a popup window. On clicking the Close button in the popup window i want to close the popup.

Help me with detailed steps of how to open and close a popup

Thanks & Regards,

Suresh

Accepted Solutions (0)

Answers (7)

Answers (7)

Former Member
0 Kudos

Hi

//Code for Opening the Created window

//Create a value attribute of type type 'com.sap.tc.webdynpro.services.session.api.IWDWindow'

IWDWindowInfo windowInfo = (IWDWindowInfo)wdComponentAPI.getComponentInfo().findInWindows("<Name of the window you had created in which the view is embedded");

IWDWindow window=wdComponentAPI.getWindowManager().createModalWindow(windowInfo);

wdContext.currentVnCommon_AttributesElement().setVaWindow_Reference(window);

window.setTitle("<Title of the window>");

window.setWindowPosition(WDWindowPos.CENTER);

window.setWindowSize(100,50);

window.show();

//For Closing the window

IWDWindow winhandle = wdContext.currentVnCommon_AttributesElement().getVaWindow_Reference();

winhandle.destroyInstance();

Regards

Chandran S

Former Member
0 Kudos

Hi,

You can use the code above to call a pop-up window from a view. However, if u want to close the window on the click of a button, make a context of type IWDWindow in both of the views(caller and callee views) and bind them thr' the controller. When in the caller view, u call the pop-up, set this context by the window name u create here. In the callee view, make a button and on its action write the following code:

wdContext.currentContextElement().get<context name>().destroyInstance(); (in 04s)

and wdContext.currentContextElement().getCtx_va_windowname().destroy(); (in 04)

Let me know if it works.

Regards,

Gita

Former Member
0 Kudos

In which view you want to close the pop up window.The above code works good if you are making use of the same view to close the pop up window.If you want to close the pop up window in another view (say view2) then you declare two methods "open" and "close" in the component controller.In the open method you try to create a popup.open();method and in the close you declare the popup.close();

method and from which ever view you want to open or close the popup window u can do it from any of the views.

windowInfo = wdComponentAPI.getComponentInfo()

.findInWindows("popup");

window = wdComponentAPI.getWindowManager().createModalWindow(

windowInfo);

window.setWindowSize(400, 130);

window.setWindowPosition(WDWindowPos.CENTER);

window.setTitle("popup window");

Declare the objects under others so that their instance can be available in any method.

WDWindowInfo windowInfo;

IWDWindow window;

former_member485701
Active Participant
0 Kudos

Hi ,

you can open a popup window in following manner:-

(1)First create a window with name "popup".

(2)Now embed the views , which you want to show in it.

(3) Now right the following lines in your button action

IWDWindowInfo windowInfo = wdComponentAPI.getComponentInfo()

.findInWindows("popup");

IWDWindow window = wdComponentAPI.getWindowManager().createModalWindow(

windowInfo);

window.setWindowSize(400, 130);

window.setWindowPosition(WDWindowPos.CENTER);

window.setTitle("popup window");

window.show();

(4) Now when you want to close this window

Store the window instance in the context.

and take it at the time of close. use following line to close the window.

window.hide();

Regards,

Praveen

Former Member
0 Kudos

If u have any doubt abt this,make a mail to me.Donot hesitate abt this.

Regards

Hazrath.G

Former Member
0 Kudos

Hi,

u can create a view under that popup window.

Then u can create one node(popup),under this u can create a context var(wininst) in component controller.

Then u can map this parameter in both the views.

Then u can write a following code in first view;

wdContext.currentPopupElement().setWininsta("window object ref");

In second view u can create a button and create a action and write the following code in the action

IWDWindow win1=wdContext.currentPopupElement().getWininstance();

win1.destroy();

attach this to the OnAction Event of button

Former Member
0 Kudos

Hi,

You need to destroy the window instance.

Hope the tutorial in the link below will help you to do that:

[https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/user-interface-technology/webdynpro/wd%20java/wdjava%20tutorials%20and%20articles%20archive/dialog%20boxes%20in%20web%20dynpro%20applications.pdf]

thanks & regards,

Manoj