Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

dynamic action


I have a scenario in which i wld be creating button ui element dynamically i need to bind a separate action to each of these.

How do i do it.

The no of buttons created would be dependent on the node size.similarly the no of actions created would be dependent on the node size.

Former Member
Former Member replied

I would suggest to use a common action, created at design-time, for all of these buttons. Use event parameter mapping to determine which button was pressed to fire the action.

Example: Create an action "ButtonPressed" with a parameter "index" (int) that will contain the index of the context node element corresponding to the button.

The code that creates the buttons looks like this:

for (int i = 0; i < wdContext.node<YourNode>().size(); ++i)
  IWDButton button = (IWDButton) view.createElement(IWDButton.class, null);
  button.mappingOfOnAction().setParameter("index", i);
  /* etc... */


0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question