Skip to Content
author's profile photo Former Member
Former Member

Handling table cells, rows and columns

Hi!

I think this will be easy for you, but unfortunately I'm a newbie in the webdynpro business.

I have an internal table and I've binded it to a table on the view.

The table seems somehow like this:

TABLE1

COL1 COL2 COL3 COL4

ROW1 CELL11 CELL12 CELL13 CELL14

ROW2 CELL21 CELL22 CELL23 CELL24

ROW3 CELL31 CELL32 CELL33 CELL34

ROW4 CELL41 CELL42 CELL43 CELL44

I would like to process this table dynamically:

- in the COL1 there is a checkbox in each row, based on it's checked/unchecked status, I would like to make the COL2 column read only/ modifiable

- when COL1 was unchecked, and now it is checked, I would like to add 1 to the COL4 field's value

Thank you

Tamá

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Jul 20, 2009 at 12:17 PM

    Hi,

    To achieve your first scenario, follow these steps,

    1. Create an attribute 'READONLY' type boolean under the same node that is bound to your table

    2. Bind this attribute to the readonly property of your Column 2 cell editor( which has to be an input field inorder to make it open for editing )

    3. Now implement the event handler method for the click of your checkbox, in this method place the following code to enable/disable your col2.

    data: context_element type ref to if_wd_context_element.
    context_element = wdevent->get_context_element( 'CONTEXT_ELEMENT' ). 
    
    context_element->get_static_attributes( importing static_attributes = ls_stru ). " contents of the row of clicked checkbox
    if ls_stru-col1 = 'X'. "checkbox is checked
    " enable/disable Col2
     ls_stru-readonly = abap_true. " to disable the field ( pass abap_false to enable the field )
    " add 1 to Col4 
     ls_stru-col4 = ls_stru-col4 + 1. " col4 should be the attribute that is bound to this column
    endif.
    
    context_element->set_static_attributes( exporting static_attributes = ls_stru ).

    Hope this helps!

    Regards,

    Radhika.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.