on 10-07-2008 11:17 AM
I have a table with editable input fields with 5 columns. I have used an event (if we press ENTER) for the input field in all columns. The event is getting triggered. Its fine. But say ex: I have pressed ENTER on column 08 , Row 3, then how to capture that row/cell ?
In short how to capture the row number on pressing ENTER on a cell of a table ?
Hi Manjunath,
Below is the solution to try capture the row number & column name of the cell in which the user has pressed enter upon.
Say suppose I have only 2 columns in my table with ID's C1 & C2. (So I also have only 2 attributes "ONE" & "TWO" under the node "NODE" which am using to bind to the table.) In the WDDOINIT method I bind an internal table with all default values to the table.
method WDDOINIT .
data: lr_node type ref to if_wd_context_node,
lt_node type ig_componentcontroller=>elements_node,
wa_node type ig_componentcontroller=>element_node.
lr_node = wd_context->get_child_node( name = 'NODE' ).
do 5 times.
wa_node-one = '0'.
wa_node-two = '0'.
append wa_node to lt_node.
enddo.
lr_node->bind_table( new_items = lt_node ).
endmethod.
Now coming to the main part i.e, handling the enter action of the user.
method ONACTIONONENTER .
DATA: lr_element TYPE REF TO if_wd_context_element,
lv_column_name type string,
lv_row_number type i value 0.
lr_element = wdevent->get_context_element( name = 'CONTEXT_ELEMENT' ).
lv_column_name = wdevent->get_string( name = 'ID' ).
lv_row_number = lr_element->get_index( ).
endmethod.
Now in the end lv_column_name would come up with the column name i.e, C1/C2 and lv_row_number would contain the position of the cell number under that particular column. Hope that this helps meet your desired task.
Regards,
Uday
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
the row is provided by the lead select of the node which is bound to the table.
lo_nd_node = wd_context->get_child_node( name = "your context node" )
data lv_indext type i.
i = lo_nd_node->get_lead_selection_index( ).
the coloumn you might get when using the event parameter of the enter action there is a parameter ID which delivers the id of the cell editor (input field)
have fun
stefan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Manjunath,
You need to checkmark the rowSelectable property & set the selectionMode to Single. But then again you get the row number only if the user does a lead selection before pressing enter on any cells in that row. Also I couldn't obtain the cell number by using the WDEVENT parameter. It just returns the id of the column in which the user had pressed enter. Stefan please suggest how we can proceed using the WDEVENT.
Regards,
Uday
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
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.