cancel
Showing results for 
Search instead for 
Did you mean: 

dynamic action

Former Member
0 Kudos

Hi

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.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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.setOnAction(wdThis.wdGetButtonPressedAction());
  button.mappingOfOnAction().setParameter("index", i);
  /* etc... */
}

Armin

Former Member
0 Kudos

Hi Armin

Ur solution is exactly what i want ,i m not allowd to set parameter

it just allows me to give the option add parameter.

button.mappingOfOnAction().setParameter("index",i);

pls help me out.

Regards

Nikhil

Former Member
0 Kudos

Sorry, the method name is "addParameter()" in older releases and "setInt()" in NW 7.1 and newer.

Armin

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi

Please check this forums link

Regards

Ruturaj

Former Member
0 Kudos

Hi,

I think you need to work around on function like mappingonsubmit().setParameter(). Go through the following threads

[]

[]

Regards

Raghu

Former Member
0 Kudos

You can go thru the following link for dynammically adding a button :

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/6fdae690-0201-0010-a580-d104b459...

Former Member
0 Kudos

hi!

set the button enable property as true and then do the parameter mapping.this is necessary for client side events.

chk the following link for parameter mapping

http://help.sap.com/saphelp_nw04/Helpdata/EN/25/d41a403233dd5fe10000000a155106/content.htm

former_member192434
Active Contributor
0 Kudos

Hi

follow this link

http://help.sap.com/erp2005_ehp_03/helpdata/EN/04/72a840bd6d3c13e10000000a155106/frameset.htm

once you create dynamic button, then you need to access that button thru button id. and once you get the id you can perform different action.

Thanks