on 10-14-2008 8:40 AM
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
Thank you very much Vijay
Now, could you please explain how to bring the column definition of the table view into the iterator
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Vijay,
Yes, i may be wrong. Could you please explain me how to go about it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.