cancel
Showing results for 
Search instead for 
Did you mean: 

Passing Dynamic events to UI elements??

Former Member
0 Kudos

My scenario is given like the action name of Ui element(link to action element), image source name and position id is given in database  as shown below..based on view name

view namepositionImageAction
P11pic1.jpgCLICK
P12pic2.jpgSEND
P13pic3.jpgGEN_REPORT

There are 3 UI elements(LInk to action element) used in a view.Now what are they expecting me to do..Dynamically i can set the image name by binding the property of image_source to some string variable and then pass the value to string.

But there is nothing to bind in events...we can only create new..there is no binding available????how to do do it...??May be is it related to assistance class??

Help me out please

Accepted Solutions (0)

Answers (3)

Answers (3)

shankar_gomare
Explorer
0 Kudos

yes can be possible, check out attributes to method you will find option for text alignment as well. If you create dynamic UI element in view you need declare action in same controller i.e viewcontroller, create action in actions tab in view controller which will generate method in viewcontroller.

Former Member
0 Kudos

Also if i pass text for the link to action in the method the text comes after the icon..Is it possible to display just like as shown below..text below icon and alignment of the icons is also same as this image shown below???

shankar_gomare
Explorer
0 Kudos

Hi,

here is code for creating link to action dynamically, properties of link to action UI element is attribute to the static method. use below code in WDDOMODIFYVIEW method.

   DATA lr_container    TYPE REF TO cl_wd_uielement_container.

   DATA lr_linktoaction TYPE REF TO cl_wd_link_to_action.

   DATA lr_matrix    TYPE REF TO cl_wd_matrix_head_data.

   IF first_time = abap_true.

     lr_container ?= view->get_element( 'ROOTUIELEMENTCONTAINER' ).

     CALL METHOD cl_wd_link_to_action=>new_link_to_action

       EXPORTING

*        bind_image_source          = give image source here

         on_action                   = 'CLICK' " Create action CLICK in actions tab

         text                        = 'Link'

         visible                     = '02'

       RECEIVING

         control                     = lr_linktoaction

         .

     lr_matrix = cl_wd_matrix_head_data=>new_matrix_head_data( lr_linktoaction ).

     lr_linktoaction->set_layout_data( lr_matrix ).

     CALL METHOD lr_container->add_child

       EXPORTING

         index     = 1

         the_child = lr_linktoaction.

   ENDIF.

Former Member
0 Kudos

Thanks..i am new to webdyn...I have a question..Using the above code we can create link to action dynamically..What about on_action ,we can pass the name in the above code.but we should have defined the method with the same name in methods tab in view or component controller??