Skip to Content
avatar image
Former Member

Dynamic Link to action and its action

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Jun 07, 2008 at 09:48 AM

    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

    Add comment
    10|10000 characters needed characters exceeded