cancel
Showing results for 
Search instead for 
Did you mean: 

Doubt about Event Parameter

Former Member
0 Kudos

Hi Experts,

I've a doubt.

I want to create a view with many buttons, but instead of creating an action for every button I want to create only one action that depending on which one is clicked triggers a logic or another. I understand that I have to create an action with one parameter that represents my button (IWDButton, I guess), but I don't know how to inform the action which button was pushed. I read this article: [http://help.sap.com/saphelp_dm40/helpdata/en/60/1f1f056f057d4d962375efd3c92ed0/content.htm] but I'm lost.

All my buttons has a parameter named "clickedButton", type: IWDButton

Is it possible or I'm wrong?

Thanks in advance,

Joan

Accepted Solutions (1)

Accepted Solutions (1)

gill367
Active Contributor
0 Kudos

hi

you can achieve this by adding the parameter and giving its value different for different buttons

write the following code in wddomodifyview method.

if(firstTime) {

IWDButton btn1 = (IWDButton)view.getElement("<btn1_id>");

IWDButton btn2 = (IWDButton)view.getElement("<btn2_id>");

btn1.mappingOfOnAction().addParameter("id","1");

btn2.mappingOfOnAction().addParameter("id","2");

}

then in the eventhandler

write

String Id = wdEvent.getString("id");

now if id is 1 it is coming form first button and 2 means from the second button.

thanks

sarbjeet singh

Former Member
0 Kudos

Thanks! It solved my problem, I didn't get how to bind my buttonId to the action.

Regards,

Joan Roda

Answers (0)