05-01-2009 6:47 PM
Hi All,
I have an OO ALV with an input enable column and would like to highlight a cell in a different color when the user changes it's value.
I am using pr_data_changed->get_cell_value to check the cells value has changed and pr_data_changed->modify_cell to update the cell with the new value.
The output table has a field called CELLCOLOR of type LVC_T_SCOL which I am using to highlight the cell in red:
lw_cellcolor-fname = 'THISFIELD' .
lw_cellcolor-color-col = '7'.
The ALV layout is also correclty set using: layout-ctab_fname = 'CELLCOLOR'
All the above is working fine and the changed cell is highlighted HOWEVER it only works if I call METHOD g_grid->refresh_table_display
Is there anyway to highlight the cell without calling method refresh_table_display??????
I do not like to call method refresh_table_display in an ALV event. The main reason is if a user changes a cells value and at the same time selects the row for update then the method refresh_table_display wipes out the row selection marker.
So Is there anyway to highlight the cell without calling method refresh_table_display??????
All your help appreciated
Che
05-01-2009 7:02 PM
Try this way
In the PAI use
call method get_selected_rows
This will get you the row index of the selected rows from the screen for example I_ROW
In PBO
call method g_grid->set_selected_rows
exporting
it_row_no = i_rows[].
then call refresh_table_first_display
So this one will keep row selection after the refresh_table_first_display method
a®
05-01-2009 7:29 PM
Hi a®s,
PAI and PBO are not called, this is all done in the HANDLE_DATA_CHANGED event. As a temporary solution (may become permanent) I am using something similar to your solution:
handle_data_change
---get_selected_rows
---refresh_table_display
---set_selected_rows
The above is working, would still like to know if it can be achieved without calling refresh_table_display in an event.
Che
05-01-2009 10:42 PM
Hi,
Try this :
In the handle_data_changed method implementation, call the method get_selected_rows and store this in the event handlers attritbute.
And in the handle_data_change_finished method( which is the event handler method for data_changed finished of cl_gui_alv_grid ) call the set_selected_rows passing the table that you stored in previous method.
I'm not sure if this will work , but worth a try.
regards,
Advait
Edited by: Advait Gode on May 1, 2009 11:43 PM