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

Similar Messages

  • 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.

  • 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.

  • 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.

  • 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.

  • 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.

  • 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

  • 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

  • Based on some conditions table rows should be of different color

    Hi Experts,
    I have created one WD application which calls RFC. The displayed result is
    Trip No    Date                 Status
    1             01-jan-2009     Approved
    2             05-jan-2009     Rejected
    3             09-jan-2009     Cancelled
    I want to ensure that row no 1 should be of color 1 (say green color), row no 2 should be of color 2 (say red color) and row no 3 should be of coor 3 (say black color).
    How I can do so?
    Regards,
    Gary

    Hi
    Please go through this forum, this will help you:
    1. How to enable alternating color in a table rows?
    2. How to Change the color of rows in a table
    3.  how to set table alternating color
    Thanks
    Susmita

  • 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 Rows with Multiple Conditions Not Showing Up in RH

    Hi everyone,
    I'm currently evaluating TCS2 (Framemaker 9 and RoboHelp 8 on Windows XP) and have come across the following issue:
    One of our FrameMaker source files contains a table in which one of the rows has multiple conditions applied. When one of the conditions is shown in Framemaker, and the others are hidden, the row is displayed in Framemaker as expected. However, when the file is then imported or linked into Robohelp, the same table row vanishes, even though the Apply FrameMaker Conditional Text Build Expression check box is selected in the Framemaker Conversion Settings > Other Settings screen. This only appears to affect table rows - when paragraph text is tagged with the same conditions, it is imported correctly into RoboHelp.
    For example, when Condition B is shown and Condition A is hidden in the Framemaker file, the content appears like this in Frame:
    Unconditional
    Unconditional
    Condition A and Condition B applied
    Condition A and Condition B applied
    Condition B applied
    Condition B applied
    Paragraph text with Condition A and Condition B applied.
    Paragraph text with Condition B applied.
    When the same file is imported into RoboHelp, the row with both conditions applied is absent from the table:
    Unconditional
    Unconditional
    Condition B applied
    Condition B applied
    Paragraph text with Condition A and Condition B applied.
    Paragraph text with Condition B applied.
    Installing patches 8.0.1 and 8.0.2 did not resolve the issue (and actually caused other, unrelated issues) and I see the same behavior regardless of whether I import or link the FrameMaker document.
    Has anyone else seen this issue? Any help would be much appreciated.
    Thanks
    DaveB

    It just seems that the items I select as align to top in the
    property inspector should force the items to the top of their
    cells, unless I'm missing something.

  • Adobe Form - Hide a table row if a condition met

    Hi Helper
    I am learning how to use Adobe Form - and I am trying to hide a table row if a condition is met by using Formcalc/Jave script - but I donot know how - I was told that I can use "....presence = 'hide'  " property in on of the event(?) but donot know how to write the qualified name for the varable row and what event to use. Could someone please show me how
    Points will be rewarded.
    Thanks

    Hi Liem,
    Here is some more information:
    1)
    Accessing data in Table Cell
    xfa.resolveNode("xfa.data.my_data.tableData[" + this.parent.index  + "].column1").value
    2)  Accessing data nodes in Context
    xfa.datasets.data.my_data.second_node.an_attribute.value == "3"
    I think you will find the WebLog below very useful for your requirements.
    /people/juergen.hauser2/blog/2007/09/03/accessing-data-nodes-in-sap-interactive-forms
    -regards,
    harman

Maybe you are looking for