cancel
Showing results for 
Search instead for 
Did you mean: 

Hide radio button from radiogroup?

0 Kudos

Hi!

I have a situation where I'm building the component controller context, view context, the mapping and the view itself dynamically. One of the UI elements in the view is a RadioButtonGroupByIndex and the code to build the view looks something like this...

      lref_radiobutton_group_by_idx = cl_wd_radiobutton_group_by_idx=>new_radiobutton_group_by_idx(

            bind_texts = lv_bind_text

            id         = lv_radio_button_group_id

            on_select  = lc_on_radio_select

            col_count  = lc_number_of_columns ).


Now under these circumstances, is there a way to make just one of the radio buttons under the group as invisible? I did try using the set_attribute_property by getting the child elements of the group (which logically should be the radio button), but it doesn't seem to be so straight forward.


Any suggestions?


Thanks,

Praveen

Accepted Solutions (0)

Answers (3)

Answers (3)

0 Kudos

Hi Kiran and Rama,

Appreciate your comments, but deletion doesn't cut it... The scenario I'm trying to model here is such that each of the radio buttons in the group represents a status, and there can only be one status active at a time. But now it can so happen that the user has not enabled the current active status to be part of the list of statuses that are shown on the screen. But then we can't have a radiobuttongroup without at least one of the statuses as active. So the idea was that in such a scenario we will have a dummy radio button as part of the group itself but will be hidden to the user :). But I guess if this is not possible I'll use a different approach.

Thanks,

Praveen

former_member184578
Active Contributor
0 Kudos

Hi,

That's not possible. You could alternately create individual radio button UI and set the visibility.

Regards,

Kiran

ramakrishnappa
Active Contributor
0 Kudos

Hi Praveen,

As suggested, you can delete the elements which are not required in the view. or just populate only required element of radio button, instead of passing many and setting visibility property to none.

Regards,

Rama

former_member184578
Active Contributor
0 Kudos

Hi,

You can use remove_element( ) method of context node.


DATA lo_nd_node TYPE REF TO if_wd_context_node.

    DATA lo_el_node TYPE REF TO if_wd_context_element.

    DATA ls_node TYPE wd_this->element_node.

 

    lo_nd_node = wd_context->get_child_node( name = 'NODE' ).

  

*  Get element to remove

    lo_el_node = lo_nd_node->get_element( index = 2 ). " to remove 2nd radio button


*Or., you can check the text using get_attribute( ) method and see if it is the

radio button ( corresponding to that text) to remove and the remove_element.

    lo_nd_node->remove_element( lo_el_node ).

hope this helps,

Regards,

Kiran