on 11-25-2011 10:17 AM
Hi guys,
I need help considering the following scenario:
I am enhancing WD-Component FITE_VC_GENERAL_DATA. I need to dynamically register an action to a certain checkbox in ROOTUIELEMENTCONTAINER>TRANSP_ACCO_CONTAINER>TRANSPORT_ROWREP>TRANSPORT_CONTAINER>TRANSPORT_CHECKBOX
The contents for the row repeater come from a customizing table, could be 10, could be 100. Up Until now, I've cast down the UI Tree for the row repeater to eventually register an action via method set_on_toggle. But I am unable to understand how to get the exact one checkbox that I need. The ID is (as far as I understood from help.sap.com) dynamically the index is variable (since the customizing table might be changed).
Here's my 'attempt' of coding I did so far:
lo_el_ui_root ?= wd_comp_controller->z_go_view->get_element( 'ROOTUIELEMENTCONTAINER' ).
lo_el_trans_cont1 ?= lo_el_ui_root->get_child( ID = 'TRANSP_ACCO_CONTAINER' ).
lo_el_rowrep ?= lo_el_trans_cont1->get_child( ID = 'TRANSPORT_ROWREP' ).
lo_el_rowrep->get_row_elements( RECEIVING the_row_elements = lt_trans_rows ). " now what do I do with this -_-
I have to admit I'm pretty much lost after getting the instance of the row repeater. Getting the row elements was more or less a stab in the dark.. I'm unsure whether it makes sence at all. Could you help me out?
Any help (coding-wise and explanatory) would be very much appreciated.
Cheers, Lukas
It is true that it gets complex the way you do. i would try to do with generic action. Anyway the action handler would receive the standard params like index the row repeater , context_element etc.
Work around here to call different methods based on the selection.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Baskaran,
thanks for replying so fast. Can you elaborate more on the suggestions you made? What do you mean with a generic action and in what way would it help me to find the right checkbox-UI-Element I need? I'd also appreciate if you could provide some code snippets so I can understand better 😐
EDIT: Another thing that confuses me. After GET_ROW_ELEMENTS, I get exactly one entry of , whereas the transparent container is below the row_repeater in the UI tree. So naturall I expected 8 transparent containers since I have 8 entries in the customizing table. Anyway in this one Transparent container I receive CH_CHILDREN where I can see ->, but here I am lost again because I cannot see which one of the X checkboxes I am at momentarily.... grrrrrr....
Cheers, Lukas
Edited by: Lukas Weigelt on Nov 25, 2011 1:18 PM
WHat i meant was, You have a checkbox UI element inside row repeater, bind the action onToggle to "xxx_checked" , while creating the action , make sure that the event parameters are selected. This would result that your event handler method has context_element , id as additional parameters.
you can use
context_element->get_attribute(
exporting
name = 'attribute name'
importing
value = lv_value )
now you have the selected context, if you want to do any other checks or do it here and from here call other methods or even event handlers with custom event object.
for example
wd_this->onactioncheck_row(
context_element = " ref to if_wd_context_element
id = " string
wdevent = " ref to cl_wd_custom_event
).
I could make a little progress, thanks to you.
I now have a registered action (with eventing parameters, i.e. ID and WD_CONTEXT) on the checkbox within the row repeater.
The event is working; however, now I somehow have to distiguish WHICH of the repeated checkboxes is being checked in order to take further actions. Though, it doesn't matter on which of the eight checkboxes I click, the ID is always the same (?).
I am, yet again, confused. Does the row repeater create X UI-Elements within himself or does he only make it 'reflect' it on the frontend whereas there's only one object in runtime?....
Bottom Line: how to I distinguish between the 8 checkboxes that can be checked in runtime?
Cheers, Lukas
You are right, I have the context element. I just read the static attributes and thus have access on a field which provides me with the respective key from the customizing table; this is even better than getting the index. After some more coding I was able to achieve what I wanted
Thanks a ton Baskaran! Your hint with setting the parameters for event handler method (ID and context_element) did the trick eventually! I got a better understanding of row repeaters now too!
Cheers, Lukas
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.