cancel
Showing results for 
Search instead for 
Did you mean: 

issue in rendering Icon in Table View thru Iterator

Former Member
0 Kudos

I have a tableview with SINGLESELECT mode. Initially the ICON column in the tableview has to display red color light 'ICON_RED_LIGHT'. When the user selects a row in the tableview the icon has to change to yellow color light 'ICON_YELLOW_LIGHT'. How should I accomplish this in MVC with iterator.

In 'render_cell_start' method of iterator I wrote the code as follows

CASE p_column_key .

WHEN 'ICON'.

r_search_result ?= p_row_data_ref.

DATA: lcl_tableview TYPE REF TO cl_htmlb_tableview.

DATA: icon_light TYPE string.

CREATE OBJECT lcl_tableview.

icon_light = cl_bsp_mimes=>sap_icon( id = 'ICON_RED_LIGHT' ).

lcl_tableview->id = p_cell_id.

lcl_tableview->onRowSelection = 'render_yellow_light'.

icon_light = cl_bsp_mimes=>sap_icon( id = 'ICON_YELLOW_LIGHT' ).

p_replacement_bee = cl_htmlb_image=>factory( id = p_cell_id src = icon_light ).

ENDCASE.

and in DO_HANDLE_EVENT f controller class I wrote the code as

CASE event_tableview->server_event.

WHEN 'render_yellow_light'.

ENDCASE.

but its not working please help

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Thank you very much Vijay

Now, could you please explain how to bring the column definition of the table view into the iterator

former_member188685
Active Contributor
0 Kudos

>Now, could you please explain how to bring the column >definition of the table view into the iterator

you have a method GET_COLUMN_DEFINITIONS in the iterator . you want this or some thing else..?

former_member188685
Active Contributor
0 Kudos

if you want to change the color when ever you select then you may have to work with onRowselection and Selectionmode.

<htmlb:tableView id               = "t1"
                       table            = "//model/it_vbap"
                       selectionMode    = "SINGLESELECT" 
                       onRowSelection   = "Myrowselection"
                       hasLeadSelection = "TRUE"
                       iterator         = "<%= controller %>" />

in the do_handle_event method you can do this..

data: event1 type ref to cl_htmlb_event.
  event1 = cl_htmlb_manager=>get_event( request ).

  if event1 is not initial and event1->name = 'tableView'.
    data: tableview_event type ref to cl_htmlb_event_tableview.
    tableview_event ?= event1.

case tableview_event->server_event.
when 'Myrowselection'.
 "here you can perform what ever you want.
"identify the row , based on SELECTEDROWINDEX 
"of the tableview_event
"this you can use in interator also 
"and show different icon if you want.
endcase.

endif.

check the example application SBSPEXT_TABLE and see the page

TableViewIterator.bsp

Former Member
0 Kudos

Hello Vijay,

Yes, i may be wrong. Could you please explain me how to go about it.

former_member188685
Active Contributor
0 Kudos

But you are assigining this to local tableview, but where you are mapping this to the main table view.

DATA: lcl_tableview TYPE REF TO cl_htmlb_tableview.

...

lcl_tableview->id = p_cell_id.
lcl_tableview->onRowSelection = 'render_yellow_light'.

I don't think your approach is correct.