cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Radio button in table view

Former Member
0 Likes
978

Hi,

I am having scenario to put 3 radio buttons (for 3 columns as group) in table view using table view iterator.

How can I create a radio button like input field in iterator through CL_HTMLB_RADIOBUTTON class.

Can anybody please give me solution how to do it.

Thanks in advance

Srinivas S

View Entire Topic
Former Member
0 Likes

Hi Thanks for your inputs.

Here I clubed both of your solutions.


method if_htmlb_tableview_iterator~render_cell_start.
 
  data: rbg type ref to cl_htmlb_radiobuttongroup,
        rb  type ref to cl_htmlb_radiobutton,
        rad_gp TYPE REF TO cl_bsp_bee_table.
 
  check p_column_key = 'FMODE'.
 
  create object rad_gp.
 
  rbg = cl_htmlb_radiobuttongroup=>factory( 
          id = p_cell_id columncount = '2' ).
  rad_gp->add( element = rbg level = 1 ).
 
  rb ?= cl_htmlb_radiobutton=>factory( id = '1' text = 'One' ).
  rad_gp->add( element = rb level = 2 ).
 
  rb ?= cl_htmlb_radiobutton=>factory( id = '2' text = 'Two' ).
  rad_gp->add( element = rb level = 2 ).
 
  p_replacement_bee ?= rad_gp.
 
endmethod.

Thanks for your great help

Srinivas S

-


Message was edited by: Brian McKellar

Reformatted source, and changed sequence so that create object is after check.

former_member181879
Active Contributor
0 Likes

Yes, of course, once all radio buttons are in one column, things are much easier, the source more elegant and better to manage.

One final comment: all factory methods contain both an ID and ID_POSTFIX parameters. So in cases where we have sub controls, like radio buttons in a radio button group, I like to use the following code:


rbg = cl_htmlb_radiobuttongroup=>factory(
   id = p_cell_id columncount = '2' ).
 
rb ?= cl_htmlb_radiobutton=>factory( 
   id = p_cell_id id_postfix = '1' text = 'One' ).
 
rb ?= cl_htmlb_radiobutton=>factory(
   id = p_cell_id id_postfix = '2' text = 'Two' ).