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

a question about the read_only property of table

Hi ,

I m trying :

in a table,only the selected row is input enabled,other rows should be dynamically deactivated.

is this idea possible to realize ?

best regards.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Oct 08, 2008 at 08:52 PM

    Hi

    It is completely possible to realize, here are the steps to follow to make this happen: ( This is only up to my knowledge, if any one suggest any easy / better process you can go with that )

    1. In the context node, where you have your table data, create a new attribute of type WDY_BOOLEAN, say READ_ONLY and when you fill the context, fill this attribute with 'X'

    2. When you create the table binding to the table element on the View, choose the Cell Editor as Input Field

    3. Then the Table node will generate all the columns in the table element.

    4. Each Column will have Value and Label, so for your requirement, you need to bind the readOnly attribute to the newly created READ_ONLY attribute of the table context.

    5. Next step is to create a event for onLeadSelect for the table.

    6. With in this event, you need to read the table context and make the READ_ONLY attribute for all the rows again 'X' and mark ' ' for the lead select.

    7. The purpose of making all the row 'X' is because, when you change the row selection on table, it should set back the row to read only.

    8. So with this approach, you can set the entire row as editable, or only selected columns of the row as editable(if you create multipe read_only attributes.

    Let me know if you have any question on the approach

    Regards,

    Trikanth

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 09, 2008 at 05:35 AM

    Hi,

    You can try proceed as follows.

    1) Create an attribute of type WDY_BOOLEAN (say VISIBILITY) under the same node which you use for binding to your table ui element. Checkmark the "READONLY" checkbox for this attribute.

    2) Go to the cell editor of each table column and bind the cell's READONLY attribute to the context attribute created earlier. (VISIBILITY attribute)

    3) Now in the WDDOINIT method write the code for filling the table with data & for making all the rows of the table as readonly.

    NOTE: I have taken the lt_mara, wa_mara, selected_row as attributes at view level. Please find their corresponding definitions as below.

    lt_mara type IG_COMPONENTCONTROLLER=>ELEMENTS_MARA

    wa_mara type IG_COMPONENTCONTROLLER=>ELEMENT_MARA

    selected_row type i

    METHOD wddoinit .
      DATA: lv_node TYPE REF TO if_wd_context_node,
            selected_row TYPE i VALUE 0.
    
      SELECT matnr
             ersda
             ernam
             mtart
             matkl
             meins FROM mara INTO CORRESPONDING FIELDS OF TABLE wd_this->lt_mara
                                     WHERE meins = 'GM' OR meins = 'CCM'.
    
      lv_node = wd_context->get_child_node( name = 'MARA' ).
    
      LOOP AT wd_this->lt_mara INTO wd_this->wa_mara.
        wd_this->wa_mara-visibility = 'X'.
        MODIFY wd_this->lt_mara FROM wd_this->wa_mara TRANSPORTING visibility.
      ENDLOOP.
    
      lv_node->bind_table( new_items = wd_this->lt_mara ).
    ENDMETHOD.

    4) Associate an action (say ONLEADSELECT) with the tables lead selection. In the event handler for this action ONACTIONONLEADSELEC write the code for setting the row selected as editable and the others as readonly.

    method ONACTIONONLEADSELECT .
      DATA: lv_node TYPE REF TO if_wd_context_node.
    
      lv_node = wd_context->get_child_node( name = 'MARA' ).
    
      wd_this->selected_row = lv_node->get_lead_selection_index( ).
    
      LOOP AT wd_this->lt_mara INTO wd_this->wa_mara.
        wd_this->wa_mara-visibility = 'X'.
        MODIFY wd_this->lt_mara FROM wd_this->wa_mara TRANSPORTING visibility.
      ENDLOOP.
    
      READ TABLE wd_this->lt_mara INTO wd_this->wa_mara INDEX wd_this->selected_row.
      wd_this->wa_mara-visibility = ' '.
      MODIFY wd_this->lt_mara INDEX wd_this->selected_row FROM wd_this->wa_mara TRANSPORTING visibility.
      lv_node->bind_table( new_items = wd_this->lt_mara ).
    ENDMETHOD.

    Hope this helps answer your question.

    Regards,

    Uday

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 09, 2008 at 03:33 PM

    Hi friends,

    thanks for your answers.

    I think you want to bind the 'readonly' property of the celleditor to an attribute of a context node,

    and through changing the attribute of the context node to control if it is readonly.

    But the 'readonly' property of the celleditor is for a column , not for a row, right?

    So if you changed the attribute "readonly" in a context node, then the readonly property of COLUMN will be changed,but not the row.

    Can you help me to understand what you mean?

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi,

      Thanks for your reply.

      on the basis of your idea I guess I will get the end effect:

      when I change the lead selection,then the readonly property of the column(say column A) will also be changed,so of course the readonly property of the row in the column A will also be changed.

      if I have misunderstood ,pl correct me.

      Here is my needs:

      I have a table which has 5 columns. Two of the 5 columns are inputfields, the other columns are just textview. The effect that I want is to dynamically set only the inputfield of the selected row NOT READONLY and all the other inputfields READONLY .

      with your idea i can still not get the point how to handle my problem. Can you pl explain me further?

      Thanks

      best regards

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.