cancel
Showing results for 
Search instead for 
Did you mean: 

Opening a new view in a new window on click of a table row entry.

Former Member
0 Kudos

Hi Guys,

How to open a new View of a same application in a new window (just like a pop up) on a click of a Table Row entry?

I am using NWDS 7.0 version. So please suggest acccorrdingly.

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member191569
Active Participant
0 Kudos

Hi Nikesh,

first of all you will have to declare use of onLeadSelect event handler for your table (note that it will only be triggered when a lead selection occurs not a multiselection).

Also, you can build at design time a View and a Window (for example, PopupWin) in your WebDynpro Component, and embed the view into the window.

In your code for onLeadSelect function, you can use something like this to pop up the window.

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

{

//@@begin onActionSeleccionTabla(ServerEvent)

IWDWindowManager windowManager = wdComponentAPI.getWindowManager();

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

IWDWindow window = windowManager.createModalWindow(windowInfo);

window.setWindowPosition(WDWindowPos.CENTER);

window.setWindowSize(new WDCssSize(450, WDWindowUnitOfLength.PX) , WDCssSize.UNDEFINED);

// Store handle ti window in context attribute to able to close it later

wdContext.currentContextElement().setPopup(window);

window.show();

//@@end

}

Hope it helps,

David

Former Member
0 Kudos

I would not open a new window when the selection of the table changes but use an explicit trigger like a link inside the table row or a toolbar button that relates to the currently selected row.

Armin

nitin_mahajan2
Contributor
0 Kudos

Agreed with Armin, the issue would be with the clicks that happen by mistake and you would have multiple windows being opened, which may just be a "Bad UI design".

Regards,

Nitin

Former Member
0 Kudos

Hi Armin,

Can you please tell me how to add a link to a row entry. Also , how will it call the new View..I mean do I need to pass some parameters or what?

Please elaborate more on this option.

Former Member
0 Kudos

Hi David,

It seems your code is working fine. But I have not added your last line of code . i.e. wdContext.currentContextElement().setPopup(window);

Please tell me what exactly is this Popup attribut's type and what it does?

After running your code, without the last line, the new popup window is getting opened. Now, some questions:

1. How to close this pop up window?

2. How to go back to last view, and click on another row item?

3. Actually, user shouldn't be able to go back to previous view, unless and until it closes the pop up window and/or Print this pdf. (My new window is a pdf document i.e. smart form)

Former Member
0 Kudos

The type of attribute "popup" should be (Java native type) IWDWindow. Create this attribute in the component controller and create a context mapping from the view controller V1 that opens the popup window and from the view controller V2 that is embedded in the popup window. In V2, add an action "ClosePopup" that hides or destroys the popup window. This action could be assigned to a "Close" button inside view V2.

Armin

Former Member
0 Kudos

Add an additional table column with cell editor = LinkToAction. Create an event parameter mapping to identify the table row. To do that, map the implicit event parameter "nodeElement" to an action parameter of type IWDNodeElement or I<Node>Element, where <Node> is the data source node of the table.

The code to open a modal popup window has already been given.

Armin