Color a table row

Hello community!
I'm using a table in a view, and I'd like to color some rows depending on a condition value.
I've found some tips for coloring a row when using an ALV, but that's not my case.
How could I do that?
Thanks for any help =)
Have a great day =)
C.

Hi,
In this link -
Re: How to make Row of a table Editable. -check Manoj's reply
they have used READ_ONLY to edit but you can use the same coding but replcae that READ_ONLY with the WDUI_TABLE_CELL_DESIGN type. Replace READ_ONLY as CELL_DESIGN.
Write the code in the WDODOMODIFY View and get the table reference.
In the LOOP.....
if....
cell_design = '01'.
else.
cell_design = '02'.
endif.
ie
LOOP AT lt_node INTO ls_node.
IF sy-tabix = lv_index.
ls_node-cell_design = '01'.
ELSE.
ls_node-cell_design = '02'.
ENDIF.
MODIFY lt_node INDEX sy-tabix FROM ls_node TRANSPORTING cell_design.
ENDLOOP.
Is this clear....
Regards,
Lekha.

Similar Messages

  • Getting error while setting color to table rows?

    Hi All
    I am trying to setting colors to table rows based on dropdown value.
    lv_Dropdown vaue =1 i want to set one color, 2-another color like that.
    For this I create attribute CELL_DESIGN of type WDUI_TABLE_CELL_DESIGN in node, and i bind this attribute to every column celldesign property in table. and my code in on select of dropdown.
      data lr_column type ref to cl_wd_table_column.
    data:obj_table type ref to cl_wd_table.
    lr_column = obj_table->get_column( id = 'TABLE_WEEK1' ).
    if lv_dropdown = 1.
       lr_column->set_cell_design(
    cl_wd_table_column=>e_cell_design-badvalue_dark ).
    endif.
    lr_column->bind_cell_design( path = 'SEGMENT1.CELL_DESIGN'  ). ...Giving dump at r_colum = get_column( )
    I follow correct code or not??
    Cheers,
    Venkys.

    Sorry Sarbjeet and baskaran i am not getting,
    I want to set colors to row of a table on dropdown selection. In dropdown i ahve a code like
    DATA lo_nd_segment1 TYPE REF TO if_wd_context_node.
      DATA lo_el_segment1 TYPE REF TO if_wd_context_element.
      DATA ls_segment1 TYPE wd_this->Element_segment1.
      data lt_segment1 type wd_this->elements_segment1.
      DATA lv_segment TYPE wd_this->Element_segment1-segment.
    navigate from <CONTEXT> to <SEGMENT1> via lead selection
      lo_nd_segment1 = wd_context->get_child_node( name = wd_this->wdctx_segment1 ).
    get element via lead selection
      lo_el_segment1 = lo_nd_segment1->get_element( ).
      lo_el_segment1 = WDEVENT->GET_CONTEXT_ELEMENT( 'CONTEXT_ELEMENT' ).
    get all declared attributes
      lo_el_segment1->get_static_attributes(
        IMPORTING
          static_attributes = ls_segment1 ).
    DATA : lv_dropdown type string .
    lv_dropdown =  ls_segment1-segment.
    if lv_dropdown = 1.  SET ONE COLOR TO THAT ROW
    endif.
    if lv_dropdown = 2.  SET ONE COLOR TO THAT ROW
    endif.
    Now what should be the code in WDMODIFYVIEW method to set table row with colors.
    Cheers,
    Venkys.

  • Coloring individual table rows based on a condition

    Hi Experts,
    I have a table bound to a node in the context via datasource property.
    I was trying to color an individual row based on a certain value in the context node.
    Can anyone help my achieve this please?
    For example:
    for( int i=0; i<table.size(); i++)
        if(wdContext.tableNode().getTableElementAt(i).getFieldA().equals("Y"))
            // then color the table row
    Any suggestions?
    M

    Solved.

  • Color of Table row

    I created a table at design time and binded data from model. I want to change tables first row to red color. I tried to change at design time but all rows colour are being changed.
    Can any one tell me how to do it?

    Hi,
    Create a value attribute "cellEditorColor" under the table node  of type com.sap.ide.webdynpro.uielementdefinitions.TableCellDesign.
    Map the attribute "cellEditorColor" to "cellDesign" property of all the table column.
    To set the color of the row in the table
    IPrivate<your view>.ITableNodeElement ele = wdContext.nodeTableNode.getTableNodeElementAt(<row index>);
    ele.setcellEditorColor(WDTableCellDesign.BADVALUE_DARK);
    This works irrespective of type of cell editor in the column.

  • Need to  color a Table row based on a Column value

    Dear Alll
    I have a requirement to color the rows of a table based on a column value in it. I have tried and surfed many useful materials over the net. but none of them solves my purpose. Please help me, I know that i can used OADataBoundValueViewObject and create a custom css file and apply color to a particular column of a table using a decode in the select statement of that VO.
    But all i need is to color a particular row with a particular color. Need your help with this ........
    Please do reply
    Best Regards
    Edited by: Antony Jayaraj on Mar 27, 2012 8:54 PM

    These posts might help you.
    How to change the row color based on Condition
    Can we colour the rows in the column of a table
    Regards,
    Peddi.

  • Coloring a table row

    I have a scenario in which i populate data in table ui thru Rfc call.Now I select a particular row then on clicking of a button the row color should change.how do i change colors of a particular row at runtime?
    Note:dont not post blogs of colorful tables.
    regards
    Nikhil Tapkir

    Hi Nikhil,
    Check out this link
    http://help.sap.com/saphelp_nw04/helpdata/en/0e/23b3c8b0a238439f664f73a04e6332/frameset.htm
    Thanks
    Anup

  • Conditional coloring in table row

    Hi,
    I want to show some table cells highlighted with some colors.for different condition.For example if status is active then show in green otherwise show in red.
    How can i achieve ?

    User, please tell us your jdev version!
    The way to go is to point the inline style of the component (or the style class if you have a css defined for the different colors) to a bean method. In the bean method you calculate the right color or style for the cell and return it. The bean method can access the other attributes of the current row rendered to get to the right result.
    In some easy cases you can use a ternary EL to get to the right color like
    #{row.value > 0 ? green : red}
    which will color all positive numbers in the cell green and all negative numbers red.
    Timo

  • How can i set the alternating colors for a table rows

    Dear All,
    Please any one help me how can i set the Alternating colors for Table Rows.
    i created a theam there i set the background alternating color to brown and i set the table design properity to alternating. but it is not reflecting.

    Hi,
    The design property in Table properties should work for your requirement. Select "alternating" value for design.
    Please see the API below:
    design
    Determines the appearance of the table. The property design can take the following values and is represented by enumeration type WDTableDesign.
    alternating - The table rows are displayed alternately in a different color.
    standard - The table background has one color. The individual table rows are displayed with grid net lines.
    transparent - The table background is transparent. The individual table rows are displayed without grid net lines.
    Check whether you have changed the right property or not? Also table should contain more than one rows to test this scenario.
    Regards,
    Jaya.
    Edited by: VJR on Jun 17, 2009 6:43 PM

  • Blue-white colored table rows

    Hi, table design gurus!
    I need in blue-white colored table rows. It looks like Table desing in altenating mode. Alternating mode fits my needs except one. This mode restricts read-only tables but I have regular table with editable cells. Well, I have read an article about how to build colorful tables. Ok, I have got a table in a different colors. But neither blue or white color were not found in WDTableCellDesign. How to use blue and white colors for table row background? I should not ovveride CSS using WD Theme Editor. I want to set a color implicitly in java code. Please, help me.
    Any help would be apprecited.

    Hi Alexey,
    I have never used it, but there is a property called semanticColor in the TextView of the columns of the table.
    Go to the layout of the view. Look in the Outline. There you will find Table -> TableColumn -> Caption + TextView. In the properties of the TextView you will find in the semanticColor.
    The semanticColor needs to be linked to an element inside the table in the context. So create a node inside the table with cardinality 1..1 and selection 1..1 and add a (calculated) attribute to the node with the correct type (I don't know this one....it is probably inside "com.sap.ide.webdynpro.uielementdefinitions". My guess would be com.sap.ide.webdynpro.uielementdefinitions.TableCellDesign.
    Ones you have linked the cell to the attribute in the node you will have to code the changes in color doing something like this. that will probably be easiest if the attribute is of the calculated kind
    In the calculated attibute you return WDTableCellDesign.GOODVALUE_LIGHT or whatever color you want.
    Hope this helps a bit,
    Jeschael

  • How do I change the background color of a row in a table indicator?

    Hello,
      How do I change the background color of a row in a table indicator? I know how to change the background color in a active cell, but that is not what I want. My first intent is to make the background color of the first row a unique color, such as green, just to highlight the top row of the table.
    Regards,
    Kaspar
    Regards,
    Kaspar

    I have done this before by using a for loop to change the active cell of a row in order to give the appearance that the whole row is turning the color at once.
    CLA, CLED, CTD,CPI, LabVIEW Champion
    Platinum Alliance Partner
    Senior Engineer
    Using LV 2013, 2012
    Don't forget Kudos for Good Answers, and Mark a solution if your problem is solved.

  • To color a specific row in a Table UI element

    Hello Experts,
    We have a requirement to highlight (with distinguish color) a specific row of a table UI based on column data.
    Suppose we have a table with 5 column and 10 row, now if the data on 5th column greater than some XYZ value then we need to highlight the specific row with a different color.
    Can anyone please help me to achieve this requirement?
    Thanks & Regards,
    Sambaran Chakraborty

    Hi,
    In your outline, I am missing quite a few prerequisites which I mentioned (not sure if you have implemented them already)
    your sub node, does it have singleton=false, cardinality 1..1 and selection cardinality 1..1?
    The attribute of type TableCellDesign in that sub node, does it have the calculated property to true?
    If you've bound each table column's cellDesign property to this calculated attribute, you just put some code in the generated generated get<SubNode><CalcAttribute> method to set the color
    For instance by just entering the line
    return WDTableCellDesign.CRITICALVALUE_LIGHT
    in that method will render each linked cell to that color
    Not sure what else I can say to explain this, there's not much to code...

  • Change the background color of selected row in adf table

    Hi,
    Can somebody guide me in changing the background color of a row when its being selected. In my ADF table, one of the column is of type Command Link. So whenever i click this command link on any particular row that complete row color should change as an indication of that row being selected.
    Please guide me to do this. I referred to other forum posts, but they couldnt meet my need.
    Thanks
    ri

    Hi Frank,
    you're right. This should work. But the result is not perfect from my point of view.
    I use
    <af:table ...>
      <af:column ...>
        <af:outputText value="#{row.col1}" inlineStyle="#{row.mystyle}"/>
      </af:column>
    </af:table>and I get e.g. this in HTML:
    <table ...>
      <tr>
        <td class="af_column_cell-text OraTableBorder1111"><span style="font-weight:bold;">qqq</span></td>
      </tr>
    </table>while I would prefer to get somethig like this:
    <table ...>
      <tr>
        <td style="font-weight:bold;"><span>qqq</span></td>
      </tr>
    </table>, which looks much smarter. Is it possible?
    Thanks,
    Alexandre.

  • Table row change color on hover

    Hi,
    I don't know if it's possible to change table row color on mouse hover, I've been looking at skin-selectors (http://www.oracle.com/technology/products/jdev/htdocs/partners/addins/exchange/jsf/doc/skin-selectors.html#Global%20Selectors) and I haven't found any row style class for af:table Component... if anyone knows how to achieve this I would be thankful.

    Hi,
    I replied to the other question of yours. I don't think this is possible because the row is not a component that can have a style applied to it. You may be more successful in applying the CSS to the components (outputText or inputText) on the table cells.
    Frank

  • Alternate row color for table question

    I'm alternating the row color on a table, and if I have a
    <a href> in
    the table, the background behind the <a href> isn't the
    same as the row
    color based on:
    <tr bgcolor="###iif(currentrow mod
    2,de('ffffff'),de('efefef'))#">
    Is there a way to have the CSS that formats the <a
    href> change at the
    same time as the background color for the row??

    How about a way to do it without having to learn something
    else (like a
    framework??)
    Anyone done something like what I'm looking to do? Just
    change the <a href>
    formatting to go along with the inline iif shown below?
    <tr bgcolor="###iif(currentrow mod
    2,de('ffffff'),de('efefef'))#">
    Steve
    "Daverms" <[email protected]> wrote in
    message
    news:fgn5vi$83b$[email protected]..
    > Hi,
    >
    > Try implementing the "JQuery" framework in your
    application. It really
    > minimizes the coding time and enables you to concentrate
    on development
    > alone.
    >
    > (Try Googling, You can find more JQuery solutions for
    this TR alternative
    > bgcolor issues, ).
    >
    >
    >
    >

  • How to set text and background color of current row in a adf table?

    Hi,
    In jdev 11.1.2.3,
    How to set text fond and background color of current row in a adf table?
    I tried to set Background color in table property, but that is not what i want.
    Thanks.

    Hi,
    We almost had the same requirement, but we just needed to color a specific column.
    Here goes the solution to that, you might do the same for your row highlighting
    Changes are required in jsff and one method to be added in backing bean
    1. JSFF :
    <af:column headerText="Amount"
                     id="c4" width="100"
                     inlineStyle="#{backingBeanScope.BackingBean.cellColor}">2. Backing Bean
    //searchResultTableVO is Table's VO
    public String getCellColor() {
          FacesContext ctx = FacesContext.getCurrentInstance();
          ExpressionFactory ef = ctx.getApplication().getExpressionFactory();
          ValueExpression ve = ef.createValueExpression(ctx.getELContext(), "#{row}", FacesCtrlHierNodeBinding.class);
          FacesCtrlHierNodeBinding node = (FacesCtrlHierNodeBinding)ve.getValue(ctx.getELContext());
          Row row = node.getRow();
        if(row.equals(searchResultTableVO.getCurrentRow())){
    //You can add your inline style for font-style too
          return "background-color:Red;";
             return null;
      }Hope this is helpful :)
    Regards,
    Neha..

Maybe you are looking for

  • Single Student home directory for Multiple users

    Hi all, I'm currently working in an education environment and we have 4x labs of mac's. Currently, when students log in, their login info/permissions are pulled from AD and OD. When they login for the first time, it creates a local home directory wit

  • More than one iCloud and match on the same iMac

    We have 3 users accounts and 3 apple ids on the same iMac. Can we each use our own icloud on our own user account , as previously with itunes match have got myself locked out for having the computer associated with more than one apple id.

  • Can't get mac back to how it was following manual restore from Time Machine

    My MBP, 13-inch, early 2011 10.8.4 has an SSD to boot from in HD bay and a HD in the optical bay where I have my user folder. I dropped the mac when it was switched on and the HD got screwed up and I consequently had to initialise it. The drive is fi

  • Finding structures in which tables they are

    Hi Guis, If we have a strucrure How to find the tables in which this structure has been used. Thanks, Santhosh

  • Problems with effects in PSE 10 (was from cappy pappy)

    I have an IMAC and use PSE 10 for my photoshop.  I have several Florabella add ons that I use and was trying to add some new ones last night.  So I went through the usual steps but when I went from photo creations to photo effect there was no photo e