Skip to Content
avatar image
Former Member

Dynamic Check Box and Toggle link creation

Hello All,

Any one Please let me know how to create check boxes and toggle link dynamically based on table records. if i have 5 records in a table, i need to create 5 checkboxes and 5 toggle link .

Thanks in advance,

Sachin

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • avatar image
    Former Member
    May 14, 2008 at 09:19 AM

    hi sachin.......

    use themethod new_checkbox in the class cl_wd_checkbox to create a new check box. first read the number of records and loop it accordingly.

    ---regards,

    alex b justin

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 14, 2008 at 09:37 AM

    Hi Sachin

    just try the following code.

    DATA: lr_ui_root TYPE REF TO if_wd_view_element.

    DATA: lr_check TYPE REF TO cl_wd_checkbox.

    DATA: lr_container TYPE REF TO cl_wd_uielement_container,

    lo_layout_data TYPE REF TO cl_wd_flow_data.

    DATA: lv_id TYPE string.

    *Declare a parameter io_view ref to if_wd_view.

    CALL METHOD io_view->get_element

    EXPORTING

    id = 'TC_ATTR_SRCH_CRITERIA'

    RECEIVING

    element = lr_ui_root.

    lr_container ?= lr_ui_root.

    *TC_ATTR_SRCH_CRITERIA is the tranparent container which *i have created statically.

    lr_container ?= lr_ui_root.

    CALL METHOD cl_wd_flow_layout=>new_flow_layout

    EXPORTING

    container = lr_container.

    CALL METHOD cl_wd_checkbox=>new_checkbox

    EXPORTING

    id = lv_id

    bind_checked = 'PROCESSES.CHECK'----


    > create a node(process) and attribute (check->WDY_BOOLEAN) in context

    enabled = 'X'

    *read_only = 'X'

    visible = '02'

    *view = VIEW

    RECEIVING

    control = lr_check.

    cl_wd_flow_data=>new_flow_data(

    EXPORTING

    element = lr_check

    ).

    lr_container->add_child(

    EXPORTING

    the_child = lr_check ).

    similarly u can use the class CL_WD_TOGGLE_LINK to create toggle link.

    regards

    chythanya

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 15, 2008 at 02:53 AM

    hi,

    Data: lr_ui_root type ref to if_wd_view_element,

    Lr_container type ref to cl_wd_uielement_container.

    *get reference to any node

    Lr_ui_root = view->get_element(

    Exporting

    Id = ‘ROOT UIELEMENTCONTAINER’).

    Lr_container ?= lr_ui_root.

    *set container properties

    Call method cl_wd_matrix_layout=>new_matrix_layout

    Exporting

    Container = lr_container.

    *set width

    Call method lr_container-.set_width

    Exporting

    Value = ‘100%’.

    Data :lr_check_box type ref to cl_wd_checkbox.

    lv_cb_id type string,

    lv_bind_checked type string,

    lr_cb_new type ref to cl_wd_checkbox,.

    Lr_check_box =cl_wd_checkbox=>new_checkbox(

    exporting

    id = lv_cb_id

    bind_checked = lv_bind_checked

    read_only = 'X'

    receiving

    control = lr_cb_new ).

    Lr_container->add_child(exporting the_child = lr_check_box).

    similarly create a toggle link using class CL_WD_TOGGLE_LINK for toggle link

    Add comment
    10|10000 characters needed characters exceeded