on 10-23-2014 6:54 PM
Hi!
How do you go about setting one or more checkboxes of a checkboxgroup as checked on load? The checkbox group is inside a pop-up and the view is dynamically built. I don't seem to have any option to achieve it from CL_WD_CHECKBOX_GROUP at least. Guess then the only way will be read the elements individually and set them as checked?
Thanks,
Praveen
Hi,
In WDDOINIT method, after initializing and binding the check box group using bind_table, you can use set_lead_selection_index( 2 ) ( 2 is to default 2nd check box selected) method of context node.
hope this helps,
Regards,
Kiran
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kiran,
I'm sorry but I'm missing something here...
In WDDOINIT, I only have my mapping paths defined... Mapping the component controller context with the view context. The view itself I have built in WDDOMODIFY using 'CALL METHOD cl_wd_checkbox_group=>new_checkbox_group' and passing the bind_texts parameter to bind the text of course.
I'm not quite sure where does 'bind_table' or 'set_lead_selection' fits in here... Neither are they part of the ' CL_WD_CHECKBOX_GROUP' class... Can you expand or point me to an example?
Thanks,
Praveen
Hi,
Are you creating the context node dynamically? If not, then in your wddomodify view method, inside if first_time = Abap_true.
after binding check box texts,
use
lo_nd_node->set_lead_selection_index() method '' here node is the name of context nose to which the checkbox group texts is bound
Regards,
Kiran
Hi,
If you want to set multiple checkbox's you can use set_selected( ) method of context element by looping the check box texts.
Let say you are binding the checkbox texts from an internal table lt_check.
And your context node is say, CHECK
Then,
DATA lo_nd_check TYPE REF TO if_wd_context_node.
DATA lo_el_check TYPE REF TO if_wd_context_element.
lo_nd_check = wd_context->get_child_node( name = wd_this->wdctx_check ).
LOOP AT lt_check INTO ls_check. " Loop check bx texts
lo_el_check = lo_nd_check->get_element( sy-tabix ).
Based on your condition set the check box.
Say you want to set 2 and 3 selected.
if sy-tabix = 2 or sy-tabix = 3.
lo_el_check->set_selected( abap_true ).
endif.
ENDLOOP.
hope this helps,
revert for further clarifications
Regards,
Kiran
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
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.