cancel
Showing results for 
Search instead for 
Did you mean: 

Hide UIElemement in RowRepeater

jakob_steen-petersen
Active Participant
0 Kudos

Hi

Is it possible to hide/unhide a UIElement when using the row repeater? I have a list of items showed with an RowRepeater - but in some of the items i do want a checkbox to be visible for the user and sometimes not.

That is: the checkbox should be invisible in some items and ready for input in others.

Example:

Text: Item 1

Price: 123.45

-----

Text: Item 2

Price: 321,45

-----

Text: Item 3

Price: 999,88

<checkbox>

-----

Accepted Solutions (1)

Accepted Solutions (1)

ramakrishnappa
Active Contributor
0 Kudos

Hi Jakob,

Yes its possible, to control the visibility of items inside row repeater

Please follow the below steps to achieve your requirement

  • Create an attribute CHECK_VIS of type WDUI_VISIBILITY in the context node of items
  • in the layout, bind the visibility property of check box to the attribute CHECK_VIS
  • Now, while populating the data to the context node, you can set the value of CHECK_VIS as below

ls_data-Text = 'Item 1'.

ls_data-Price = '123.45'.

ls_data-check_vis = '01'. "hidden

append ls_data to lt_data

-----

ls_data-Text = 'Item 2'.

ls_data-Price = '123.45'.

ls_data-check_vis = '01'. "hidden

append ls_data to lt_data

-----

ls_data-Text = 'Item 3'.

ls_data-Price = '123.45'.

ls_data-check_vis = '02'. "Visible

append ls_data to lt_data

Hope this helps you.

Regards,

Rama

jakob_steen-petersen
Active Participant
0 Kudos

Perfect - works like a charm 🙂

Thank you!

ramakrishnappa
Active Contributor
0 Kudos

Thats cool

Answers (1)

Answers (1)

harsha_jalakam
Active Contributor
0 Kudos

Hi Petersen,

If you want to hide the UI element checkbox without adding an extra attribute, check with the following code where you can change code to set visible property..

lo_element_set = lo_node->get_elements( ).

loop at lo_element_set into lo_element.

IF <condition>.

lo_element->set_attribute_property

      EXPORTING

        attribute_name = 'ATTRIBUTE_NAME'  " Attribute name of the check box

      property         = lo_element->e_property-visible

        value          = ABAP_FALSE.

endif.

endloop.

Make sure u have binded the visible property of UI element.

Regards,

Harsha