cancel
Showing results for 
Search instead for 
Did you mean: 

Closing IWD Window

Former Member
0 Kudos

Dear Experts

I am creating a window using the Class IWDWindow and I am able to popup the window. In the new window I am having a button called Cancle, On click of it I need to close the window.

window.close() is not working

Can you please suggent me how to close the window on cancel button click

Regards

Noel

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Answers (8)

Answers (8)

Former Member
0 Kudos

hi

try this

IWDWindowInfo windowInfo = (IWDWindowInfo)wdComponentAPI.getComponentInfo().findInWindows("AddressbookWindow");

IWDWindow window = wdComponentAPI.getWindowManager()

.createWindow( windowInfo, true);

window.setWindowPosition(300, 150);

window.open();

create a context WINDOWINSTANCE of type IWDWINDOW in component controller and map better the main and popup view

// Save WindowInstance in Context

wdContext.currentPopupElement().setWindowInstance(window);

in the Cancel button create a action and write this code

IWDWindow window =

wdContext.currentPopupElement().getWindowInstance();

window.destroy();

Thanks

Former Member
0 Kudos

hi Noel,

try setting the attribute value in component controller rather then in main view.

Just give it a try

Former Member
0 Kudos

Hi Noel,

Are you binding the window instance from view1 to controller and then controller to pop up view?

if the window object is null that could mean that the value is not passed from main view to pop up view

Former Member
0 Kudos

Dear Aishwarya

All the binding are fine i check it once again. I have a attribute in Component controller and that attribute is mapped to both the View and popup window but only the attribute value in popup window is null

I dont know why attribute value is getting passed

Regards

Noel

Former Member
0 Kudos

hi,

Refer this pdf, step by step procedure is there.

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/user-interface-tec...

Regards,

Sunaina Reddy t

Former Member
0 Kudos

I see no reason why close() should not work (even if it is deprecated in newer versions). Please post the code of the action handler for the "Cancel" button. Are you sure the action handler is called at all?

Armin

Former Member
0 Kudos

Dear Armin

The action handler is correctly used, because the other code in the action is working fine,but the window alone is not closing

Regards

Noel

Former Member
0 Kudos

Hi Noel

Use window.destroyInstance(); method to distroy window

Regards

Ruturaj

Former Member
0 Kudos

hi,

check this article for closing pop up window

https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/20d2def3-f0ec-2a10-6b80-877a71ec...

you have to write following code on close button

IWDWindow window = wdContext.currentPopupNodeElement().getPopupAttribute();

window.hide();

window.destroyInstance();

you can also try the following code

Create a new window and embed the popup view

create a windows instance

to start the popup:

IWDWindowInfo windowInfo = wdComponentAPI.getComponentInfo().findInWindows("PopUP");

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

window.setWindowPosition(300, 150);

window.open();

wdContext.currentExternalWindowElement().setWindowInstance(window);

to close the popup

IWDWindow window=(IWDWindow)wdContext.currentExternalWindowElement().getWindowInstance();

window.destroy();

Former Member
0 Kudos

Dear Expert

I am use the same code

IWDWindow window=(IWDWindow)wdContext.currentExternalWindowElement().getWindowInstance();

window.destroy();

but the window object is null

I am setting the attribute in parent window, I am able to print where it is not null Can you suggest a solution

Regards

Noel

Former Member
0 Kudos

Hi,

Use window.distroy() method.

0r

window.distroyInstance();

or

window .hide()

or

wdThis.wdGetPopAppController().closePopup();

Regards,

Sunaina Redyy T