cancel
Showing results for 
Search instead for 
Did you mean: 

dynamic buttons and actions

Former Member
0 Kudos

Hi

I want to add the field Id as a parameter into the action. He does this, but always the last fieldid and not the one which is used

//@@begin wdDoModifyView

if (firstTime)

{

IWDTransparentContainer rootElement = (IWDTransparentContainer) view.getElement("ButtonTransparentContainer");

for(int i = 0; i < wdContext.nodeYtf_Buttons().size(); i++)

{

wdContext.nodeYtf_Buttons().moveTo(i);

IWDButton button = (IWDButton) view.createElement(IWDButton.class, wdContext.currentYtf_ButtonsElement().getFieldid());

button.setText(wdContext.currentYtf_ButtonsElement().getName());

button.setTooltip(wdContext.currentYtf_ButtonsElement().getTooltip());

button.setWidth("250");

IWDAction action = view.getAction("SetButtonAction");

button.mappingOfOnAction().addParameter(wdContext.currentYtf_ButtonsElement().getFieldid(),0);

button.setOnAction(action);

rootElement.addChild(button);

}

}

}

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

You probably want

String fieldID = wdContext.currentYtf_ButtonsElement().getFieldid();
button.mappingOfOnAction().addParameter("fieldID", fieldID);

This will add to each button's event parameter mapping a parameter "fieldID" and you can use that value to decide which button triggered the action.

Armin

Former Member
0 Kudos

thanks armin, it solved it next to some changes i made

Answers (0)