cancel
Showing results for 
Search instead for 
Did you mean: 

Placing links in tables

Former Member
0 Kudos

Hi,

I need to insert links instead of plain text on the first column of a Table that I use to show the results of a search.

I've managed to replace the TextView with a LinkToAction and now the text on the first column is clickable.

Now all that I need is to get the reference to the row of the link that has been clicked, in order to extract some data to perform an action. The problem is that clicking one link does not make a row selection on the table, and so using a call to wdContext.currentTableRowDataNode().getAttributeThatINeed() does not work, because the current row selection on the table does not follow the click on the link.

Can someone tell me how to "fix" this?

Thank you,

Pietro

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Pietro,

You need to to do parameter mapping:

First of all you have to add a parameter say 'element' to you Action( which is assigned to LinkToAction UI element):

e.g. if the name of the Action id GetDetails then you have to add a parameter of the type I<name of the node>Element to the action:

e.g. see the following:

onActionGetDetails(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, <namespace>.wdp.IPrivate<View Name>.I<node name>Element element )

After you have done this, you have to do the parameter mapping between the parameter 'nodeElement' of the event onAction of the UI Element LinkToAction and the parameter 'element' you added in your action. The event onAction has an internal parameter called 'nodeElement'. And by doing the parameter mapping we just get the refrence to that parameter in the parameter of our action. Hence after the parameter maaping is done, the parameter 'element' of our action will point to the 'nodeElement' parameter of onAction event. This parameter gives us the currently accessed element of the node.

Following are the 2 options for doing parameter mapping:

Option A:

1.Right clcik your LinkToAction UI elemnt in the table in the Outline View when your Layout tab is open in your NWDS and select 'Parameter Mapping'

2.Map the parameter lement' from your action to the parameter 'nodeElement' in the event onAction( drag it from the right and drop on the left)

Option B:

If you do not see the 'Parameter Mapping' option on right click og the LinkToAction in the outline view then follow these steps:

Try the following code in wdModifyView Method:

if(firstTime)

{

IWDLinkToAction lta = (IWDLinkToAction)view.getElement("<id of your LinkToAction>");

lta.mappingOfOnAction().addSourceMapping("nodeElement","element");

}

Either of these options will establish the parameter mapping.

After this is done, you can use the parameter 'element' ,which points to the currently accessed element of the node, to acces the values of the other attributes. e.g. in your example:

onActionGetDetails(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, <namespace>.wdp.IPrivate<View Name>.ITableRowDataNodeElement element )
{

element.getAttributeThatINeed() ;

}

Regards,

Ajay

Former Member
0 Kudos

Thanks Ajay!

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Use parameter mapping.

Please refer :

Regards,

Himanshu

Former Member
0 Kudos

Thank you for your answer. I've seen your links but this is a little bit difficult to grasp.

Could you provide me a simple code example of passing the row to a linkToAction action method?

Greetings,

Pietro

Edited by: pietro.m on Jul 26, 2010 11:49 AM

Former Member
0 Kudos

Can you tell me the NWDS version that you are using.

Regards,

Himanshu

Former Member
0 Kudos

NetWeaver Developer Studio 7.1 SP03

Thanks,

Pietro