cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic Link to action and its action

Former Member
0 Kudos

Hi,

I'm creating link to action UI dynamically, based on number of records i'm getting from R/3. I have mapped all the links to the same actions. now wen i click on the link i want to get the details related to that link and pass on through that action.

since my clicking on each link it should direct to different page and the data also varies..

How to solve this? help me out with sample code..

Thanks

Suresh

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Use event parameter mapping to identify which link has triggered the common action.

Example:

Action "LinkClicked", parameter "linkID" : string


wdDoModifyView(...)
{
  ...
  for (int i = 0; i < n; i++)
  {
    IWDLinkToAction link = (IWDLinkToAction) view.createElement(IWDLinkToAction.class, "Link" + i);
    link.setOnAction(wdThis.wdGetLinkClickedAction());
    link.mappingOfOnAction().setString("linkID", link.getId()); /* use addParameter() in earlier releases */
    link.setText("Link #" + i);
    container.addChild(link);
  }
}

Action handler:


void onLinkClicked(..., String linkID)
{
  wdComponentAPI.getMessageManager().reportSuccess("Action triggered by link with ID " + linkID);
}

Of course you can add any parameter you want, not only one that contains the link ID.

Armin

Former Member
0 Kudos

thanks Armin,

I'm using the same code. we are looping out and creating the links dynamically. suppose if , say n=5 to we have all the 5 ids of the link in parameter LinkID String???

Regards,

Suresh

Former Member
0 Kudos

This code has the effect that the parameter "linkID" contains the ID of the link that was clicked.

Armin