on 07-20-2009 11:11 AM
Hello Colleagues,
In our screen we have a push button which adds one node to the context when used. The node is having a few fields which are shown in the UI.
So as you keep on pressing the button, additional rows will be appended on the screen.
Now, I have added another button on each of these rows. On clicking of which it should remove the row (the node). So each time you press the button 'Add element', additional rows will be appended, and each row will have a button 'Remove Element'.
But, the problem I am facing is in the implementation of 'Remove Element'.
The button 'Remove Element' is mapped to an action. But since there are as many 'Remove Element' buttons as there are rows, how do I identify which node is to be deleted ?
I have tried with get lead selection etc. but it didnt work.
Is there any way we can find out which UI element has trigerred the deletion, in the code of 'onactionSOMETHING' ?
Thanks
Gagan
Hi,
In the onAction method of your 'Remove Element' button you can find the id of the button that was clicked.
The id of your remove element button and your node should be interlinked, so that it will be easier to identify. This should be kept in mind when you create your node and your button. For eg, when you create your first button, if the id is rb_1, your node should be smthing like node_1.
you can use the following piece of code to remove/delet your node
* Data declarations
DATA: node_info TYPE REF TO if_wd_context_node_info,
lt_nodes TYPE wdr_context_child_info_map,
ls_nodes TYPE wdr_context_child_info.
* delete the node
node_info = wd_context->get_node_info( ).
lt_nodes = node_info->get_child_nodes( ).
READ TABLE lt_nodes INTO ls_nodes WITH KEY name = 'NODE_1'. " your node name
IF sy-subrc EQ 0.
node_info->remove_child_node( name = 'NODE_1' ).
ENDIF.
Radhika.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
In the WDEVENT parameter of the action handler you can find the event id.
***Variables
DATA:
lv_selected type string. "Selected tab value
***Structure and internal table for the Events and messages
DATA:
lt_events type WDR_EVENT_PARAMETER_LIST,
ls_events type WDR_EVENT_PARAMETER.
***Field symbols
field-symbols: <fs_value> type any. "Attribute value in events table
***Move the event table to lt_events
lt_events = wdevent->parameters.
read table lt_events into ls_events with key name = 'SAVE'. "Button Id
if sy-subrc eq 0.
assign ls_events-value->* to <fs_value>.
if sy-subrc eq 0.
lv_selected = <fs_value>.
endif. "IF sy-subrc eq 0.
endif. "IF sy-subrc eq 0.
Regards,
Lekha.
Hi Gagan,
Use the WDEVENT parameter to find out the clicked row index. The sample code is below:
DATA lo_el_X TYPE REF TO if_wd_context_element.
DATA lv_index type i.
"using the importing paramter WDEVENT, get the clicked index element
lo_el_X = wdevent->get_context_element(
name = 'CONTEXT_ELEMENT').
" Here X is your context node name mapped to table
"now using context_element u can get the index of selected row
lv_index = lo_el_x->get_index( ).
Regards,
Manne.
User | Count |
---|---|
85 | |
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.