Editing table column cell editor dynamically

I have a table in my webdynpro application. after displaying it in the browser,when a user selects a particular row and click on a edit button i want that specific row to be changed to edit mode .can anyone help me how to do this??
Edited by: harshith_reddy on Oct 20, 2011 7:49 AM

Hi harshith reddy ,
you can create attribute in your node for read only property for the table colums  and get the lead lead selection of the selected line and make it editable field
below is the sample code snippet .
NODE = wd_context->get_child_node( name = NODE_NAME').
element =wd_context->get_element( ).
*default you can set it to read only
NODE->set_attribute( value  = 'X'         name   = 'COLOUMN1' ).
NODE->set_attribute( value  = 'X'         name   = 'COLOUMN1' ).
*make the selected line editable
lv_current_index = lo_nd_dist_table->get_lead_selection_index( ).
if lv_current_index le  0 .
*   report message
    lv_msg_id = lo_message_manager->report_error_message( message_text = 'Please Select a Line Edit ').
else.
NODE->set_attribute( value  = '  '         name   = 'COLOUMN1'  INDEX  = lv_current_index ).
NODE->set_attribute( value  = '  '         name   = 'COLOUMN2'   INDEX  = lv_current_index  ).
endif.
Regards,
chinnaiya P

Similar Messages

  • How to remove multiple components border inside a single table column cell

    Hi,
    I'm adding multiple components to a table cell. To provide a good layout I'm using the following component hierarchy in a table column - table-->groupPanel--> gridPanel-->staticText Components 1 ..2 ..3. Now when I do preview in browser or run the app, the table shows up fine, but textComponent s(1,2,3) in the column are each surrounded by a border (which is the width of gridPanel border). Is there a way to get rid of this border?
    This only occurs when you add multiple components in table cell, under gridpanel layout component.
    I've tried searching for a way to remove the grid pane layout component border but couldn't find any info. Used style class border setting to not set but that doesn't help either. I checked forums, tutorial, learning sections etc., but no success. Any help or direction is appreciated..
    Thanks
    -Vinod

    Hi ,
    Can you please post the query ..what u have tried ...
    SQL> select sub from coa1;
    SUB
    XY
    XY
    XY
    XY
    XY
    HXY
    HXY
    HXY
    8 rows selected.
    SQL> select obj from coa1;
    OBJ
    AM
    AM
    AM
    AK
    AK
    AK
    ATK
    ATK
    8 rows selected.
    SQL> SELECT OBJ FROM COA1
    2 UNION ALL
    3 SELECT SUB FROM COA1;
    OBJ
    AM
    AM
    AM
    AK
    AK
    AK
    ATK
    ATK
    XY
    XY
    XY
    OBJ
    XY
    XY
    HXY
    HXY
    HXY
    16 rows selected.
    SQL> insert into coa2 (obj)
    2 (
    3 SELECT OBJ FROM COA1
    4 UNION ALL
    5 SELECT SUB FROM COA1
    6 );
    16 rows created.
    SQL> select * from coa2;
    OBJ SUB MCU DOC F
    AM
    AM
    AM
    AK
    AK
    AK
    ATK
    ATK
    XY
    XY
    XY
    OBJ SUB MCU DOC F
    XY
    XY
    HXY
    HXY
    HXY
    16 rows selected.
    SQL>
    i tried the same it worked fine .....
    so u can combine select and insert statements .. you can get the required result.....!
    Thanks
    Ananda
    Edited by: Ananda on Feb 2, 2009 7:38 PM
    Edited by: Ananda on Feb 2, 2009 7:52 PM

  • Editable table column

    I have a column in a table. The input tag's readOnly attribute is set to false.
    How do I access this new value once I click the tables Update button? Heres the column code.
    <bc4j:column attrName="TableColumnName">
    <columnHeader>
    <bc4j:sortableHeader/>
    </columnHeader>
    <contents>
    <bc4j:input readOnly="false"/>
    </contents>
    </bc4j:column>
    Thanks

    You can use the attrName attribute te set the destination.
    I am not sure what you mean. What I have is a table, which has a column. This column can be edited. When the user types within the textbox, I need to grab the value which was typed into the column. Here's why; these values are being used to populate a new table. This is being taken care of within an event handler. My problem is, when I get within the eventhandler, and retrieve the row, the value that I have at that time is the value which is stored within the database, I need the value that was typed in by the user.In the element reference it's documented as: "The attrName attribute identifies which attribute information to access. If this value is omitted, then the current attrScope will be used."
    If I ommit, the attrName attribute, how will that give me the value I trying to capture within my eventhandler. Thats what I need to figure out. Thanks for any light you can shed on this.

  • Editable table column ordering

    Before I embark on a lengthy process of handling drag and drop events, I thought I'd ask the collective knowledge if there was an easy way to create a table in which the operator can modify the order of the columns? I want the operator to be able to reorder the columns, ideally by selecting a column header and dragging it left and right to move its position relative to its neighbours.
    Thanks in advance,
    Thoric (CLA, CLED, CTD and LabVIEW Champion)

    Looks good, only missing the logic for the table data itself. See attached...
    Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
    If you don't hate time zones, you're not a real programmer.
    "You are what you don't automate"
    Inplaceness is synonymous with insidiousness
    Attachments:
    DragandDropColumns with data.vi ‏22 KB

  • Disable table column

    Hi all,
    i have a table in my WD View.
    i want to disable certain columns of the table on runtime.
    how do i do that.
    please replly soon.
    Thanks & Regards,
    Ritwik.

    Hi Ritwik,
    Each table colums has a 'Cell editor' which identifies the type of the column. i.e. text view or input field or cheeck box ect.
    If you want to enable/disable a table column, then in the table column, click on its cell editor and go to its propertys tab.Here we have
    Properties (TextView)     
    ID     TBL_FLIGHTS_AIRLINEID_EDITOR
    design     standard
    enabled     1
    hAlign     auto
    layout     native
    semanticColor     standard
    text     SEARCH_VIEW.FLIGHT_LIST.AIRLINEID
    textDirection     inherit
    tooltip     
    visible     Visible
    wrapping     0
    These properties can be set statically or can also be maintained dynamically by binding these properties to a context attribute and change the value at based on the conditions.
    To do this create a context node say 'UI_PROPERTIES', Create an attribute in it say 'ENABLED' of tye wdy_boolean (X, ' ').
    Go to the table column cell editor click on the button against the enabled button, from the F4, navigate to the context node 'UI_PROPERTIES' --> 'ENABLED'  Attribute. Select it and OK.
    A green icon is displayed on the button indicating that binding is maintained.
    Now if you want to enable/disable the table column then do a set_attribute of 'ENABLED' field as X, Space for enabled, disabled respectively.
    If you want to make few columns invisible at runtime then this can be achieved as mentioned above. Create another attribute say VISIBILITY type WDUI_VISIBILITY.
    Bind this attribute to the visibility property of the TABLE COLUMN. (Go to properties tab of Table Column).
    Set 01, 02 for Invisible, Visible respectively.
    Hope this helps.
    Regards,
    Sravan Varagani

  • Dynamically change the cell editor in the table control

    Hi..
         I have 3 columns in a table . of which in one column we need to change the cell editor dynamically at runtime.
    i.e for example i have  columns as carrid, connid and fldate.
    For the first 2 rows the cell editor for the carrid  clomn shud be a dropdown and from there on in the next rows for the same  carrid column it shud be a input field.
    Can experts plz help me how to achieve this as this is very high priority issue....
    Regards,
    Madhu...

    This is actaully fairly simple to do.  You will need to add a cellVariant to your table column. You can then dataBind a context attribute to the selectedCellVariant property of the column to control which cellVariant will be used. This allows you to control row-by-row which cell editor you want to output.
    http://help.sap.com/saphelp_nw70/helpdata/EN/bd/5d9041d3c72e7be10000000a1550b0/frameset.htm
    http://help.sap.com/saphelp_nw70/helpdata/EN/56/5e9041d3c72e7be10000000a1550b0/frameset.htm
    Also here is an example that I did the other day that uses Cell Variants within ALV.  This process is actually a little more complicated because you have to go through the ALV APIs.  To do this in a normal table is actually easier because you can create the cellVariant in the layout designer.
    Re: Freely-programmed value help for a single ALV cell

  • Dynamic table column editing

    Hi,
    I made a VO with quite complex query (nested subqueries linked with inner join) and when I dragged it from Data Control to the page I didn't get the familiar context menu with implementation options I used to get it earlier.
    Instead of, I got an implemented table with following structure:
    - af:table - t3
    - af:forEach
    - af:column - #{...}
    - af:outputText - #{...}
    Did I get a dynamic table?
    My problem is that I cannot get the list of attributes from VO query and then to edit table columns.
    They are shown in table at runtime but with default properties. I can set up af:column options generally but I need to set up all of the attributes individually.
    Is this a query-level problem or there is another way doing this?
    Regards,
    Aleksandar Čkrebo

    Hi,
    I made a VO with quite complex query (nested subqueries linked with inner join) and when I dragged it from Data Control to the page I didn't get the familiar context menu with implementation options I used to get it earlier.
    Instead of, I got an implemented table with following structure:
    - af:table - t3
    - af:forEach
    - af:column - #{...}
    - af:outputText - #{...}
    Did I get a dynamic table?
    My problem is that I cannot get the list of attributes from VO query and then to edit table columns.
    They are shown in table at runtime but with default properties. I can set up af:column options generally but I need to set up all of the attributes individually.
    Is this a query-level problem or there is another way doing this?
    Regards,
    Aleksandar Čkrebo

  • How to create a context menu in ALV table cell editor(Webdynpro abap )

    Hello Experts,
    I am having a problem in creating a context menu in a table cell editor in the ALV table output.I have assigned a 'lta' as the cell editor.But befor assigning the lta as cell editor I have assigned the menu to the lta.But when the view is rendered I can see the lta with the actioned assigned to it.But I cannot see the context menu.
    The code snippet below:
      "Create menu for each coloumn
      create OBJECT lo_menu_actions type CL_SALV_WD_VE_MENU EXPORTING
          id = 'MITM_ACTIONS'.
      lo_menu_actions->set_visible( value = abap_true ). 
      lo_menu_actions->set_visible_fieldname( value = 'ACTIONS' ).
      "ADd menu items
      CREATE OBJECT lo_menu_item_create type CL_SALV_WD_VE_MENU
      exporting
        id = 'MITM_CREATE_EXPRESSION'.
      lo_menu_item_create->set_visible( value = abap_true ).
      lo_menu_item_create->set_visible_fieldname( value = 'Create' ).
      "Add item 1
      lo_menu_actions->ADD_ITEM( VALUE = lo_menu_item_create ). 
      "  Set the cell editor for each column cell(link to an action)
      LOOP AT lt_node_dec_tab_cols INTO ls_node_dec_tab_cols .
        lv_column_name = ls_node_dec_tab_cols-object_name.
        lr_column = lr_column_settings->get_column( lv_column_name ).
       "Create 'lta' Ui item
        CREATE OBJECT lo_lta TYPE cl_salv_wd_uie_link_to_action.
        lo_lta->set_menu( value = lo_menu_actions ).
        lo_lta->set_text_fieldname( lv_column_name ).
        lr_column->set_cell_editor( lo_lta ).
        IF ls_node_dec_tab_cols-is_result EQ abap_true.
          lr_column->set_cell_design( value =
                      cl_wd_table_column=>e_cell_design-key_medium ).
        ENDIF.
      ENDLOOP.

    Hi Prakash,
    I have not come across this requirement till now to have context menu in a cell editor of alv.
    Unfortunately  the implementation of method SET_MENU of alv ui elements ( ex: cl_salv_wd_uie_text_view ) is not updating alv configurable table, instead it just stores in a global attribute as string. Hence has no effect on context menu.
    If your user is very particular about this requirement of having context menu in cell editor, you can go for a normal table. Because, normal table's cell editor has the property to set the menuID as we do it for other ui elements.
    Regards,
    Rama

  • How to control internal table columns dynamically based on input

    i have 2 fields in the selection screen - user and tcode
    we can give any number of tcodes as in put
    based on requirement i need to display all the tcodes belongs to one user in one row
    in other words
    the out put table columns should increase dynamically based on number of tcodes entered
    in the input
    how to do this?
    Edited by: tummala swapna on Apr 7, 2009 11:55 AM

    This may be useful to you..
    FIELD-SYMBOLS : <FS_TABLE> TYPE ANY TABLE.
    DATA: DREF TYPE REF TO DATA,
          WA_DREF TYPE REF TO DATA,
          DY_LINE TYPE REF TO DATA,
          ITAB_TYPE TYPE REF TO CL_ABAP_TABLEDESCR,
          WA_TYPE TYPE REF TO CL_ABAP_STRUCTDESCR,
          STRUCT_TYPE TYPE REF TO CL_ABAP_STRUCTDESCR,
          ELEM_TYPE TYPE REF TO CL_ABAP_ELEMDESCR,
          COMP_TAB TYPE CL_ABAP_STRUCTDESCR=>COMPONENT_TABLE,
          COMP_FLD TYPE CL_ABAP_STRUCTDESCR=>COMPONENT,
          OTAB TYPE ABAP_SORTORDER_TAB,
          OLINE TYPE ABAP_SORTORDER.
    BEGIN DYNAMIC STRUCTURE FOR FINAL INTERNAL TABLE @@@@@@@@@@@@@@@@@@
    STRUCT_TYPE ?= CL_ABAP_TYPEDESCR=>DESCRIBE_BY_NAME('table or structure name').
    COMP_TAB = STRUCT_TYPE->GET_COMPONENTS( ).
    STRUCT_TYPE = CL_ABAP_STRUCTDESCR=>CREATE( COMP_TAB ).
    ITAB_TYPE = CL_ABAP_TABLEDESCR=>CREATE( STRUCT_TYPE ).
    CREATE DATA DREF TYPE HANDLE ITAB_TYPE.
    ASSIGN DREF->* TO <FS_TABLE>.
    END DYNAMIC STRUCTURE FOR FINAL INTERNAL TABLE @@@@@@@@@@@@@@@@@@

  • Problem using an editable JComboBox as JTable cell editor

    Hi,
    i have a problem using an editable JComboBox as cell editor in a JTable.
    When i edit the combo and then I press the TAB or ENTER key then all works fine and the value in the TableModel is updated with the edited one, but if i leave the cell with the mouse then the value is not passed to the TableModel. Why ? Is there a way to solve this problem ?
    Regards
    sergio sette

    if (v1.4) [url
    http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/JTa
    le.html#setSurrendersFocusOnKeystroke(boolean)]go
    hereelse [url
    http://forum.java.sun.com/thread.jsp?forum=57&thread=43
    440]go here
    Thank you. I've also found this one (the first reply): http://forum.java.sun.com/thread.jsp?forum=57&thread=124361 Works fine for me.
    Regards
    sergio sette

  • HTMLB TableView Iterator & Edit columns, cells

    Hi friends,
    I am getting errors when , I tried to edit the columns, & Cells of  HTMLB TableView by using Iterator.Actually, I got the whole edit buttons and when I edit the values of particular column & cell fileds, it is not saving the values, instead it is giving same old values. The code I used is as follows.
    <u><b>To Edit the  columns,</b></u>
    method
    IF_HTMLB_TABLEVIEW_ITERATOR~GET_COLUMN_DEFINITIONS.
    FIELD-SYMBOLS: <def> LIKE LINE OF p_column_definitions.
      APPEND INITIAL LINE TO p_column_definitions ASSIGNING <def>.
    <def>-COLUMNNAME = 'STUDENTID'.<def>-EDIT = 'X'.
    endmethod.
    <u><b>To Edit the  cells,</b></u>
    RENDER_CELL_START Method:
    method
    IF_HTMLB_TABLEVIEW_ITERATOR~RENDER_CELL_START.
    CASE p_column_key.
    WHEN 'ICON'.
    WHEN 'STUDENTID'.
           IF p_edit_mode IS NOT INITIAL.
    ENDIF.
    WHEN 'SDATE'.
           IF p_edit_mode IS NOT INITIAL.
    ENDIF.
    ENDCASE.
    endmethod.
    <u><b>To Edit the SDATE cells,</b></u>
    WHEN 'SDATE'.
      IF p_edit_mode IS NOT INITIAL.
    DATA: date TYPE STRING.
    date = m_row_ref->SDATE.
    p_replacement_bee = CL_HTMLB_INPUTFIELD=>FACTORY(
                          id        = p_cell_id
                           value     = date
                           type      = 'DATE'
                             showHelp  = 'TRUE'
                             cellValue = 'TRUE' ).
                               ENDIF.
    Why the either column or cell is not saving the new values, when I edit them? where it went wrong? please mail me in this regard.
    regards
    CSM Reddy

    Hi REDDY CSM 
    To learn coding these Methods.
    You need to learn everything from scratch about MVC.
    To learn functionalities of Methods in Controller and how to use them,its Better,if you start with some tutorial(Little application) on MVC.
    Here is link,Just follow this,You will get some Exposure to these methods.
    http://help.sap.com/saphelp_erp2005/helpdata/en/c8/101c3a1cf1c54be10000000a114084/frameset.htm
    Rest keep posting whenever you face and Problem..
    Happy Coding..!!
    Vijay Raheja

  • How to display an image in particular cell editor

    Hi All,
    I want to display an image as the background for the table cell.
    I searched in sdn and found the solution only for link to action.
    I have created a dynamic table and if i click on apply button one more row is getting added according to my requirement.
    I want to differentiate this row from rest.  So I need to display image for the last row in the table which is added newly. 
    Can anyone suggest the procedure for adding an image in a particular cell editor along with the table data?
    Hope I am clear with my requirement.
    Pls suggest.
    Regards,
    subashini

    Hi,
    IF iam not wrong then for some rows u need to show text data and for some rows u need to show image data.
    follow the following steps.
    1. In ur table add cell editor of type Image.
    2.Create a value node with one more than required attributes.
    3.Suppose if need to show only one column then i will create  
       value node with two attributes.One attribute will be for text
      data and one will for Image.
    4.now access ur table cell editor dynamically.For image type
      cell editor we need to play only with two properties source
    and alt.Bind this alt property of editor wid that attribute which u
    need use for text data and source wid that attribute which u
    need to use for image.
    5.  Now suppose I need to show text data then
    I will create one element of that value node.In case of Image
    type cell editor source property  is given prefrence over alt
    property.
    set attribute which is bound to alt to the actual text data
    i.e setText("Actual text data");
    and set attribute which is bound to source to some dummy
    image name
    i.e setImage("dummy.gif");
    add this to node.
    during execution as source property of editor is bound to
    Image attribute of node  which in turn is set to dummy value it
    wont find actual source and will set Image cell editor with
    watever is bound to alt property which in turn set with actual
    text value..
    6.  Now suppose I need to show Image data then
    I will create one element of that value node.In case of Image
    type cell editor source property  is given prefrence over alt
    property.
    set attribute which is bound to alt to blank value 
    i.e setText("");
    and set attribute which is bound to source to some Actual 
    image name
    i.e setImage("Image.gif");
    add this to node.
    during execution as source property of editor is bound to
    Image attribute of node which in turn is set to Actual image file
    it will  set Image cell editor with that image name  and wont look for alt property.
    Copy all ur images in src->mimes->components->ur package
    Regards
    Surender Dahiya

  • JTable: RFC on good practice (SQL queries from cell editor)

    I usually add/remove/edit JTable data from an external panel. But in this scenario, my client would like to be able to click on the first column of an empty row and enter a product number. Within the cell editor, I must make an SQL query to the database in order to determine if the product number is valid and if so, use part of the SQL data to populate other cells of the current row (like product description).
    My problem is that this just doesn't seem right! Isn't the cell editor executed on the only Swing thread? Also, if the product number is not valid, I correctly implement the stopCellEditing() method but for some reason, you can still navigate the table (click on any other cell or press the TAB key, etc)... weird!!
    Does anyone have a good practice on how to perform the SQL query in a better place and force a cell to be selected until you enter a valid number or press the CANCEL key?
    I was looking at implementing the TableModelListener's tableChanged(...) method but I'm not sure if that would be a better place either.
    I personally would edit outside of the table, but good practice seems hard when the requirement is to edit from a cell editor!!
    Any suggestion would be greatly appreciated!
    Thanks!

    maybe you could write an input verifier for the column that does the query and rejects invalid entries.
    maybe you could send the query off in a worker thread.
    as far as making the table so you can't select any cells, hmm. not sure.
    you could disable
    .setEnabled(false);the table until the query comes back, something like that.

  • Creating a Cell Editor for a JTree

    Hi...
    I would like to be able to edit the nodes of a JTree dynamically, but I'm not sure how to do it. I have unsuccessfully tried to implement a celleditor by extended the DefaultTreeCellEditor. The editing works fine, but once the cell has been edited, I get a ClassCastException.
    I know that I need to get the edited value and then make appropriate changes to the DefaultMutableTreeNode object stored, but I am not sure where to do all this. I would really appreciate some tips on where to get the edited value entered, and how I can access the object being edited. Thanks.
    ..VJ..

    So, you have a big table whose cells each contain a little table. I assume you already have the little tables working correctly with cell editors and so on, and you want to write a cell editor for the big table. Correct?
    My problem with this is that I can't imagine how this would actually work in practice. Suppose I click on a cell in the big table; then the cell renderer displays the appropriate little table. At this point should I see one of the cells in that little table selected, and should I be able to use the Tab key to move around the little table? And if so, then I can't use the Tab key to move around the big table. Next, suppose I press F2 indicating that I want to edit the little table. What should change? Should I now be able to tab around the little table, whereas I couldn't before? And if so, how do I indicate that I have stopped editing the little table? Pressing Enter indicates to the little table's cell editor that its editing is finished, but how should I tell the big table's cell editor that its editing is finished?
    Perhaps if you can answer this, you may have a better idea of how to solve your problem. Sorry I only have questions and not answers.

  • Adding an editable row in an non editable table.

    Hi,
    My requirement is to add an Editable row in a table which is in display mode only, i mean i cannot edit the data that is present in the table.
    But if the user presses the Add Row button on the Table Toolbar, a new editable row should be added in the end, so that he can save the new data entered.
    methods tried:
    1: I have used Inputfield as Cell Editors, with their Read only Property check marked, thougt that with the new element created, it would not be Read Only.
    2: Binded the read only property with a context attribute, but still was not able to achieve this functionality.
    3: Tried the above two steps with the "Enabled" property of the Table Coloumn Cell Editors as well, but no result.
    Please give me some pointers on this.
    Regards,
    Ashish

    Hi Ashish,
    The approach you were following was correct, but I am not sure where you have placed the Enabled property attribute in the context.
    Please follow these steps:
    1. The table you are creating should have the enabled property set.
    2. The context with you are binding the table should have an additional attribute say ISENABLED of type boolean.
    3. Bind this attribute with the ENABLED property of all the input enabled fields in your table.
    4. When binding the non-editable data into the table, set this property to ABAP_FALSE for each record. This will make the existing data non editable.
    5. Use the below code for adding a new row and set the ISENABLE property of the added row to ABAP_TRUE.
        elem_table = node_table->create_element( ).
        node_table->bind_element( new_item =  elem_table set_initial_elements = abap_false ).
        stru_table-isenable = abap_true .
        elem_new_row->set_static_attributes( static_attributes = stru_table ).
    Let me know how you go about it.
    Cheers,
    Pratibha

Maybe you are looking for