on 12-12-2008 6:49 AM
Hi all,
how can i create checkboxes in my view dynamically?
Please specify all classes i need...
regards
Hi,
You would basically need to perform the following steps:
1) First get the reference of the ROOTUIELEMENTCONTAINER using get_root_element.
2) Set the desired layout to the container using the obtained reference.
3) Create an instance of the checkbox using the new_checkbox method of class cl_wd_checkbox.
4) Specify the correct layout information to this newly created checkbox.
5) Add the checkbox to the container ui element.
You would have to mandatorily bind 2 properties of the created checkbox:
bind_checked & bind_text.
The state of the checkbox would get saved into the attribute specified by bind_checked
The text to be displayed beside the checkbox would come from the attribute specified by bind_text
Try insert the following coding into your WDDOMODIFYVIEW:
METHOD wddomodifyview.
DATA: lr_container TYPE REF TO cl_wd_uielement_container,
lr_checkbox TYPE REF TO cl_wd_checkbox,
lr_node TYPE REF TO if_wd_context_node.
CHECK first_time = abap_true.
lr_container ?= view->get_root_element( ).
cl_wd_matrix_layout=>new_matrix_layout( container = lr_container ).
lr_checkbox = cl_wd_checkbox=>new_checkbox( bind_checked = 'NODE1.ATTR1'
bind_text = 'NODE1.ATTR2' ).
cl_wd_matrix_head_data=>new_matrix_head_data( element = lr_checkbox ).
lr_container->add_child( the_child = lr_checkbox ).
ENDMETHOD.
Regards,
Uday
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.