Skip to Content
author's profile photo Former Member
Former Member

How to close the pop up window ?????

Hi all,

How to close the pop up window without having its refrence and then taking control back to the parent window.Please reply in detail

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Sep 19, 2007 at 12:14 PM

    hi amit,

    If you know ur window name , then you can access it using following code and use distryinstance() function to destry the window. After it will get destryed the control will itself go to the window through which it had been launched.you can use following code.

    IWDWindowInfo windowInfo = (IWDWindowInfo)WdComponentAPI.getComponentInfo().findInWindows("ur window name"); IWDWindow window = wdComponentAPI.getWindowManager().createModalWindow(windowInfo);

    window.destroyInstance();

    I think this wud have answered ur question.

    thanks

    reena

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 19, 2007 at 12:19 PM

    You need the reference to the popup window. Store it in the context for example.

    Then to close it just execute this:

    popupInstance.destroyInstance();

    The popup will be closed and the parent window will be displayed again.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 19, 2007 at 12:22 PM

    Hi Amit,

    Create one context attribute of the type "com.sap.tc.webdynpro.services.session.api.IWDWindow".

    The action from which you open the pop up window ,set this context attribute to the window object that you have created for your popup window.

    Now,

    You need to create button on the pop window say close.

    And action of close button get the ,

    Just write the following

    IWDWindow window=wdContext.currentContextElement().getPopUpclose();

    where PopUpclose-the context attribute that you have created of window type.

    window.destroyInstance();

    It will solve your problem.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 19, 2007 at 12:53 PM

    Hi Amit,

    Follow the steps.

    Step1: Create a WD Component.

    Step2: Under Component Controller create a Value Node “EmployeeInfo” with attribute “EmployeeName” and “Position” and a context attribute “WindowInstance” of type “com.sap.tc.webdynpro.services.session.api.IWDWindow”

    Step3: Create 2 Views

    i>EmployeeView

    Layout like

    -


    Employee Name : EmployeeInfo.EmployeeName(InputField)

    Employee Position : EmployeeInfo.Position(InputField)

    DisplayResultButton

    ii>DisplayView

    Layout like

    -


    Employee Name : EmployeeInfo.EmployeeName(TextView)

    Employee Position : EmployeeInfo.Position(TextView)

    CloseWindowButton

    Step3: Create 2 Windows

    1>EmployeeWindow

    2>DisplayWindow.

    Under “EmployeeWindow” add the “EmployeeView”

    and “DisplayWindow” add the “DisplayView”

    Step3: Go to the Diagram View. Do the mapping between “EmployeeView” and “Component Controller” and between “DisplayView” and “Component Controller”

    Step4: Associate action “DisplayResult” with the “DisplayResultButton” and use this code inside the Implementation of “EmployeeView”

    public void wdDoInit()

    {

    //@@begin wdDoInit()

    wdContext.nodeEmployeeInfo().addElement(wdContext.createEmployeeInfoElement());

    //@@end

    }

    public void onActionDisplayResult(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

    {

    //@@begin onActionDisplayResult(ServerEvent)

    IPrivateEmploeeView.IEmployeeInfoElement emp = wdContext.createEmployeeInfoElement();

    emp.setEmployeeName(wdContext.currentEmployeeInfoElement().getEmployeeName());

    emp.setPosition(wdContext.currentEmployeeInfoElement().getPosition());

    wdContext.nodeEmployeeInfo().addElement(emp);

    IWDWindowInfo windowInfo =(IWDWindowInfo) wdComponentAPI.getComponentInfo().findInWindows(

    "DisplayWindow");

    // create the Window

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

    window.setWindowPosition(WDWindowPos.CENTER);

    window.setTitle("WindowTitle");

    window.setWindowSize(100,100);

    // Save WindowInstance in Context

    wdContext.currentContextElement().setWindowInstance(window);

    // and show the window

    window.show();

    //wdThis.wdFirePlugInDisplay();

    //@@end

    }

    Step5: Associate action “CloseWindow” with the “CloseWindowButton

    ” and use this code inside implementation of “DisplayView”

    public void onActionCloseWindow(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

    {

    //@@begin onActionCloseWindow(ServerEvent)

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

    window.destroyInstance();

    //@@end

    }

    Regards,

    Mithu

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 19, 2007 at 02:40 PM
    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.