on 07-20-2009 8:39 AM
Hi Experts,
I have a check box group on my view and is binded to a table of texts.
My requirement - based on first check box (If first check box is checked/true), check(Make true) second check box and disable the second check box for editing.
I am able to check(make the value true) of second check box but not able to disable it.
Please guide me in archiving the above requirement (Enable/disable).
Thanks in Advance.
Regards
Diwakar
I had to capture the selected checkboxes then disable the required checkboxes and mark the checks again.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Radhika,
I did the steps as you mentioned, the second check box is getting disabled. but the checked values of both the check boxes is getting reset (to false/unchecked).
Please let me know if I am missing any steps
Thanks in advance
Divakar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Place the following code in the onToggle method for the checkbox.
Regards,
Radhika.DATA: ls_stru TYPE wd_this->element_cn_radiobtn.
DATA: lt_data TYPE wd_this->elements_cn_radiobtn,
ls_data TYPE wd_this->element_cn_radiobtn.
*context_element = wdevent->get_context_element( 'CONTEXT_ELEMENT' ).
context_element->get_static_attributes(
IMPORTING static_attributes = ls_stru ).
DATA lo_nd_cn_radiobtn TYPE REF TO if_wd_context_node.
DATA lo_el_cn_radiobtn TYPE REF TO if_wd_context_element.
* navigate from <CONTEXT> to <CN_RADIOBTN> via lead selection
lo_nd_cn_radiobtn = wd_context->get_child_node(
name = wd_this->wdctx_cn_radiobtn ).
DATA: checked TYPE string.
checked = wdevent->get_string( 'CHECKED' ).
IF checked EQ 'X'.
" get the contents of t he node(i.e all the checkbox values)
lo_nd_cn_radiobtn->get_static_attributes_table(
IMPORTING table = lt_data ).
LOOP AT lt_data INTO ls_data.
lo_el_cn_radiobtn = lo_nd_cn_radiobtn->get_element( index = sy-tabix ).
IF ls_data-ca_key NE ls_stru-ca_key.
" disable the fields
lo_el_cn_radiobtn->set_attribute( EXPORTING name = 'CA_EDITABLE'
value = abap_true ).
ENDIF.
" mark the fields as checked
lo_el_cn_radiobtn->set_selected( abap_true ).
ENDLOOP.
ENDIF.
.
Hi Radhika,
Thanks for your reply.
I am not sure of how I have bind the second checkbox to an attribute of type boolean,because i am using a checkbox group and not a multiple checkboxes independently. and I may have more checkboxes based on the number of node elements.
I have binded only the texts to a node-attribute of type text. and i dont see a checked property in the list of properties for checkbox group
Regards
Divakar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
If you have used a checkboxgroup, follow this approach,
1. Under your node, create an additional attribute 'READONLY' type boolean.
2. Bind this attribute to the readonly property of your checkbox group
Regards,
Radhika." Code in WDDOINIT
DATA: itemlist TYPE if_viewname=>elements_nodename,
w_list LIKE LINE OF itemlist.
w_list-ca_key = 'Black'.
w_list-ca_editable = abap_false. "initially keep the checkbox enabled
APPEND w_list TO itemlist.
w_list-ca_key = 'White'.
w_list-ca_editable = abap_false. "initially keep the checkbox enabled
DATA: items_node TYPE REF TO if_wd_context_node.
items_node = wd_context->get_child_node( name = `CN_RADIOBTN` ).
items_node->bind_table( itemlist ).
" now implement the OnToggle event, and based on your condition pass abap_true to disable the required checkbox
Hi,
Bind the readonly property of your second checkbox with an attribute type boolean, and when you want to disable it pass abap_true or X.
Note: if your checked property is already bound to an attribute of type boolean you can use the same attribute to bind the readonly property, so when you make it as X it will be disabled at the same time.
Regards,
Radhika.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
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.