cancel
Showing results for 
Search instead for 
Did you mean: 

What Code Write Close PopupWindow?

Former Member
0 Kudos

Hi,

I need code for closing popupwindow.

I Have View1[FirstName,LastName]->Window1

I Have Another View2[Fname,Lname]->Window2.

I Have Component Controller [Fname,Lname] For Context Mapping From Both View1 And View2.

I Created Methods For OpenPopup And Close popup.

Open PopUp is Working Fine.After Open the Popup Window.

We Have Close Window Button.

What Code I Write Closing Popup Window.

Thanks

SubbaRao Chinta

Accepted Solutions (0)

Answers (6)

Answers (6)

Former Member
0 Kudos

Hi Subha,

If you want to close the popup window,you need to store window instance in component controller context and an simply call close(),destroy(),destroyInsatance() where ever you want to close pop up window.

Scenario:

If you have view where u r creating this popup window and want to close this through some button on popup window then map window instance context attribute between component controller to popup window'd view and call any of above given methos to close the pop up window.

I hope it would give you some understanding...

Former Member
0 Kudos

Hi,

try this code in closing that popup window button

wdThis

.wdGetKMComponentController()

.wdGetContext()

.currentContextElement()

.getFname()

.destroyInstance();

Hope this will help you

Regards,

Ramani.p

Former Member
0 Kudos

hi

for closing popupwindow the following code will work.

IWDWindow popupwindow=wdContext.current<nodename>Element.get<attributename>.

popupwindow.hide();

popupwindow.destroyinstance();

here nodeattribute must bind to the IWDWindow type.

Regards

sowmya.

Former Member
0 Kudos

Hi

just write the lin of code

IWDwindow win;

win.close();

Thanks,

Tulasi

Former Member
0 Kudos

Hi,

Hope the problem is solved..

Regards,

Arun.

Former Member
0 Kudos

Hi,

Please try this code. If every thing is mapped correctly your window will be close.

wdThis.wdGet<Name of Component>Controller().CloseWindow();

Regards,

Arun.

Former Member
0 Kudos

Thanks For Quick Reply.

I Write Code In View2 For Calling Closing Window.

i created Methods in Componnet Controller.

public void OpenPopUp( )

{

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

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

window.setWindowPosition (300, 150);

window.show();

}

I Want What Code For Closing PopupWindow.

public void ClosePopUp()

{

}

Please let Me Know ASAP.

Bye

Thanks

SubbaRao Chinta

Former Member
0 Kudos

Hi ,

Create window ,in

// @@ begin others

IWDWindow window = null;

//@@end

Then in ClosePopUp() method write

window.close();

This will close window.

Thanks ,

prajakta

nikhil_bose
Active Contributor
0 Kudos

if you want to close window in the popup itself, you need the current window instance to be passed. so create a value attribute (i call it as WindowInstance) in the context of type com.sap.tc.webdynpro.services.session.api.IWDWindow and pass it to the popup context.


public void OpenPopUp( )
{
IWDWindowInfo windowInfo = (IWDWindowInfo)wdComponentAPI.getComponentInfo().findInWindows("Window2");
IWDWindow window = (IWDWindow)wdComponentAPI.getWindowManager().createModalWindow(windowInfo);
wdContext.current<Node>Element().setWindowInstance(window);
window.setWindowPosition (300, 150);
window.show();
}

And in the popup window you can close it using


public void ClosePopUp()
{
 wdContext.current<Node>Element().getWindowInstance().destroyInstance();
}

WindowInstance is coming from parent window; so don't forget to map

nikhil

Former Member
0 Kudos

Store the pop-up window instance in a context attribute of the component controller, e.g. "popup" of type IWDWindow. Make this attribute available to the controllers that open and close the pop-up.

Create the popup-window on demand:


void openPopup()
{
  IWDWindow popup = wdContext.currentContextElement().getPopup();
  if (popup == null)
  {
    IWDWindowInfo windowInfo = (IWDWindowInfo) wdComponentAPI.getComponentInfo().findInWindows("Window2");
    popup = wdComponentAPI.getWindowManager().createModalWindow(windowInfo);
    popup.setWindowPosition (300, 150);
    wdContext.currentContextElement().setPopup(popup);
  }
  popup.show();
}

void closePopup()
{
  wdContext.currentContextElement().getPopup().hide();
}

Armin