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
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
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
* bind_image_source = give image source here
on_action = 'CLICK' " Create action CLICK in actions tab
text = 'Link'
visible = '02'
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
index = 1
the_child = lr_linktoaction.
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??
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.