on 10-13-2008 8:23 AM
Hi,
how can i register an event if someone clicks somewhere on the ALV Grid? I need something like ON_CLICK, but it should work for all cells, not only the LinkToAction and Button-Rows.
Another question: Is there an event if someone clicks on a header of a row?
Kind Regards,
Thomas
Hello Uday/Thomas
Before using ON_CELL_ACTION, cell content should be either button or link to action
DATA lr_link TYPE REF TO cl_salv_wd_uie_link_to_action .
CREATE OBJECT lr_link.
lr_link->set_text_fieldname( 'Field Name' ).
lo_column_settings ?= lo_table.
lo_column = lo_table->if_salv_wd_column_settings~get_column( ''Field Name' ).
lo_column_hdr = lo_column->create_header( ).
lo_column->set_h_align( cl_wd_table_column=>e_h_align-center ).
lo_column->set_cell_editor( lr_link ).
If the field is normal field and then ON_CELL_ACTION event will not trigger, in that case one has to use the event ON_LEAD_SELECTION, that will give the index of the row and for getting the value
get_element( index )
get_static_attribute( ) method you will be able to get the value of the field.
Regards
Vishal
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Create Method of type Event in View where you have ALV, Link that method with the Event ON_CELL_ACTION, this method will have parameter R_PARAM
DATA lv_col TYPE string.
DATA lv_index TYPE sy-index.
lv_col = r_param->column .
lv_index = r_param->index.
Using this you will be able to get the values of the cell on which cell has been clicked.
Regards
Vishal
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vishal,
I tried doing as how you had suggested but couldn't get my code triggered for the event. I tried with both the ON_CLICK & ON_CELL_ACTION events. But clicking on the table cells was only resulting in the table row getting selected (lead selection being set). I had earlier coded similar functionality for the ON_FUNCTION event and that event handler is getting triggered fine. Any ideas as to why things aren't working for these events?
Regards,
Uday
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.