cancel
Showing results for 
Search instead for 
Did you mean: 

Creating Dynamic action handler for dynamic buttons

Former Member
0 Kudos

Hi Experts,

My requirement is based on the select query , I am getting 'n' number of records in my internal table and now I need to create that 'n' number of Buttons dynamically in my Webdynpro Layout and also create same number of dynamic Action Handlers to assign the same to those dynamically created buttons.

So please let me know can we create dynamic action handlers in the code itself rather than creating manually in the view controller or component controller.

Regards,

Vishal Chauhan

View Entire Topic
RicardoRomero_1
Active Contributor
0 Kudos

Hi Vishal,


I think is not possible to create the action handler dinamically.
You can create one generic method for all your buttons and modify the logic in the code depending on the name of the button you can get from the parameter WDEVENT.

Regards,

Former Member
0 Kudos

Dear Ricardo,

Thanks a lot for your reply.

Actually on runtime , I am creating the buttons dynamically , so it may be 'n' number of buttons . So in that case , I am not sure , how can I get the the button details in WDEVENT. Based on the button click , I need to findout which button is clicked and perform the action.

Regards,

Vishal chauhan

RicardoRomero_1
Active Contributor
0 Kudos

Hi Vishal,


You have to assign a name to each button. When a button is pushed you have the name inside the parameter WDEVENT, there is a table with some values, you can read the ID.


Anyway, for your requirement may be is not necessary to create the buttons dynamically, I think you can use a Row repeater UI Element or as Amy said a table and read the CONTEXT_ELEMENT.

Former Member
0 Kudos

Hi Ricardo,

I have tried to read the pushed Button ID through WDEVENT. There is a hashed table called PARAMETERS having Name and Value fields.

But now when I am trying to read the value of the Button ID , I am not able to compare it with any variable or convert the same into variable .

So kindly help me in the same.

My requirement is to get the pushed Button ID and than compare it with my other variable.

Regards,

vishal 

former_member199125
Active Contributor
0 Kudos

Hi Vishal,

You need to create one action , while creating button dynamically assing that action.

In action declare a parameter ID type string. whenever the action trigger ID will contain BUTTON ID.

So declare your button id according to your requirement.

Regards

Srinivas

Former Member
0 Kudos

Hi Srinivas,

Thanks for your reply.

But how will that Parameter ID contains the button ID automatically . What I needs to done for getting the button ID in the string Parameter ID .

Can you please expain me in details as I am stuck here .

Regards,

Vishal Chauhan

Former Member
0 Kudos

Hi Srinivas,

Thanks for your reply. It works .

Can you please let me know , same way can we findout the Text of the button through any parameter.

Regards,

Vishal Chauhan