cancel
Showing results for 
Search instead for 
Did you mean: 

Insert an Image into a WD Table

Former Member
0 Kudos

Hi experts,

I need to insert an Image into a Table.

In my WD component, I have a Table. I have to evaluate the content of one fields, and depending on it, I have to put into another field the following images:

-CREATE_TEXT

-CHANGE_TEXT

-CHANGE

Do anybody suggest how can I do it?

Thanks in Advance!

Kind regards,

Lucas

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Lucas

Right click on the table control in the layout select create binding

and select the image as the cell editor of table column and bind the property as source.

now in wdmodify you can read the context and based on the value of desired cell you can set th icon name to the context using set attribute.

in my case i am just seeting the value here name is bound to the image property. so i am passing icon names as values.

you can pass these values based on your condition.


data wa_node type wd_this->element_node.
    data it_node type wd_this->elements_node.
*   navigate from <CONTEXT> to <NODE> via lead selection
    lo_nd_node = wd_context->get_child_node( name = wd_this->wdctx_node ).

*   get element via lead selection
    lo_el_node = lo_nd_node->get_element(  ).

*   get all declared attributes


wa_node-name = 'ICON_DISPLAY'.
wa_node-address = 'test'.
append wa_node to it_node.
wa_node-name = 'ICON_CHANGE'.
wa_node-address = 'test1'.
append wa_node to it_node.

 lo_nd_node->bind_table(
  exporting
    new_items = it_node ).

Regards

Naresh

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

In the context node that is bound to your table, declare an additional attribute 'IMAGE_SOURCE', of type string. There has to be one column in your table which will display the actual image, bind the 'source' property of this column to the IMAGE_SOURCE attribute.

Loop through your internal table, and based on the condition, set the value of the attribute, as below:

loop at itab into wa.
if cond 1.
  wa-image_source = 'CREATE_TEXT'.
elseif cond 2.
  wa-image_source = 'CHANGE_TEXT'.
elseif cond3.
  wa-image_source = 'CHANGE'.
endif.

modify itab from wa.
endloop.

Depending on the value in the attribute, the corresponding image will be set.

Regards,

Nithya