cancel
Showing results for 
Search instead for 
Did you mean: 

link to action issue--Which perticular record has hit the LINK TO ACTION?

Former Member
0 Kudos

HI Experts,

I have a table in which I have set one perticular column (column name-->Business Unit)as link to action.This column has 25 records.So all the 25 records for this perticular column are HYPERLINK.I have written an onAction for this link to action.

My Problem:-I want to get which perticular link i have clicked.

Means out of 25 records(hyperlinked) in that perticular column column,I want to know which perticular record(or which perticular hyperlink) I have click.

I want to get that percular record,so that i can use that information .

All my coding are dynamic.

Please suggest me with some sample code.

Sample code will be very helpful.

Regards-

Sandip

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

map a parameter of type IWDNodeElement nodeElement for your action handler

Use the following code in the wdDoModify to map this


if(firstTime)
	  {
		  IWDLinkToAction linkToAction =(IWDLinkToAction)view.getElement("action");
		  linkToAction.mappingOfOnAction().addSourceMapping("nodeElement", "nodeElement");
	  }

Now your action handler should look like



public void onActionActionLink(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, com.sap.tc.webdynpro.progmodel.api.IWDNodeElement nodeElement )
  {
    //@@begin onActionActionLink(ServerEvent)
	  nodeElement.getAttributeValue(attributeName);
       //Using the nodeElement you can access all the context attributes of the clicked link.
    //@@end
  }

Regards

Ayyapparaj

Former Member
0 Kudos

That's correct.

Slightly better than using the generic IWDNodeElement type inside the action handler is to either

- cast the parameter to the typed interface (I<DataSourceNode>Element), or

- declare the action parameter to have the typed interface

Armin

Answers (2)

Answers (2)

former_member197348
Active Contributor
0 Kudos

Hi Sandeep,

Create an action and bind it to link to action.

In this action write code like this to find particular record(or which particular hyperlink) I have clicked.

String currBusUnit  = wdContext.node<tablenode>().current<tablenode>Element().get<attribname>();

you can use currBusUnit for your computation.

regards,

Siva

Former Member
0 Kudos

Hi Sandip,

you can use getTreeSelcection method of the table for reading the selected row.

Code is as followed, here DeviceElement is the Value node that is binded to table:

IPrivateForm_View.IDeviceElement selnode;

int dev_no = wdContext.nodeDevice().size();

for (int i = 0; i < dev_no; i++)

{

selnode = wdContext.nodeDevice().getDeviceElementAt(i);

int empid = selnode.getEmpId();

}

In the empid variable, selected Emplyee Number will come.

Hope this helps you.

Amit