Af:table: defining row background color based on a condition

I want to display log objects (priority, name, detail) in a tab.
The background color must be green for priority "DEBUG" and red for priority "WARN".
It seems that in the table component, we can only control the column aspect and the output text inside...
I'have read some posts (Franck N.) and it seems not possible to have an action of the row (all columns) background color...
What can be the workarround ? other <af:?> component ???
Is it now possible with the new JDEV11 components ?
<af:table partialTriggers="pollRefresh" emptyText="No items were found"
value="#{backing_logviewer.logViewerList}" var="log"
rows="50">
<f:facet name="detailStamp"/>
<af:column sortable="true" headerText="Prio" formatType="text"
sortProperty="prio">
<af:outputText value="#{log.prio}"/>
</af:column>
<af:column sortable="true" headerText="Cat" formatType="text"
sortProperty="cat">
<af:outputText value="#{log.cat}"/>
</af:column>
<af:column sortable="false" headerText="Msg" formatType="text">
<af:outputText value="#{log.msg}"/>
</af:column>
<af:column sortable="false" headerText="Thread" formatType="text">
<af:outputText value="#{log.thread}"/>
</af:column>
<af:column sortable="false" headerText="Info" formatType="text">
<af:outputText value="#{log.info}"/>
</af:column>
<af:column sortable="false" headerText="Log Date" formatType="text">
<af:outputText value="#{log.logDate}" converter="dateConverter"/>
</af:column>
<af:column sortable="false" headerText="Throwable"
formatType="text">
<af:outputText value="#{log.throwable}"/>
</af:column>
</af:table>

Thanks for your answer.
Your solution is not working but if i put the styleclass instruction in the outputText element, it is working...
Is there any other solution ???... because in this solution, we are obliged to put this EL in each outputText element of the tab.
<af:column sortable="true" headerText="Cat" formatType="text"
sortProperty="cat">
<af:outputText value="#{log.cat}" styleClass="#{(log.prio == 'DEBUG') ? 'bgDebug' : (log.prio == 'WARN' ? 'bgWarn' : '')}"/> </af:column>

Similar Messages

  • Af:table rollup row background color change

    Hi All
    i got below sql view object
    SELECT DEPARTMENT_ID,JOB_ID,COUNT(*) FROM EMPLOYEES GROUP BY DEPARTMENT_ID,ROLLUP(JOB_ID)
    By using this i will get each department_id, jobid's and total employes count in each department
    and i will get rollup for each departments ie i will get total employees.
    So i want to change the back ground of the total row.
    DepartmentId     JobId     Count1
    SA_REP      1
    1
    10     AD_ASST     1
    10          1 < this row in RED back ground in JSF page
    20     MK_MAN     1
    20     MK_REP     1
    20          2 < this row in RED back ground in JSF page
    30     PU_MAN     1
    30     PU_CLERK     5
    30          6< this row in RED back ground in JSF page
    40     HR_REP     1
    40          1< this row in RED back ground in JSF page
    50     ST_MAN     5
    50     SH_CLERK     20
    50     ST_CLERK     20
    50          45< this row in RED back ground in JSF page
    any kind of help is welcome...
    thanks
    Ravi

    Ravi,
    I think I answered the same question on the JDeveloper forum. The way it goes is that you use the inlineStyle property on the outputText component(s) of the total row. If you hard code the color then all backgrounds are identical, if you use EL to reference a managed bean method to return the color then you can have conditional color rendering
    Frank

  • Row background color in dataTable control based on criteria

    It is relatively straightforward to give a pattern of color to rows in a dataTable control, for instance to alternate colors from white to gray.
    However, I have not yet figured how the row background color could be decided based on data fields associated with each row. For instance, I would like to set the row background color based on the value of a boolean attribute associated with the row, e.g. white if value is false and gray if it is true.
    Is there an easy way to do this?
    Martin

    of the text, but not the whole cell. I need to find a
    way to change the span at the row level (on the <tr>
    tag). ANy ways to do this?
    MartinThis is a question of how to let the renderer adjust its behaviour depending on the current state of the model. My renderer changes the background for the selected row by changing the style class:
            writer.startElement("tr", table);
              if (table.getRowSelector())
                   if (table.isAtSelectedRow())
                        writer.writeAttribute("class", "selectedRow", null);
    etc.(of course, to be able to do this you must write your own renderer)
    erik

  • Change Column Header / Column Background color based on a value in a specific row in the same column

    SSRS 2012
    Dataset (40 columns) including the first 3 rows for Report layout configuration (eg: the <second> row specifies the column background color).
    Starting from the 4th row, the dataset contains data to be displayed.
    I would like to change the background color of the ColumnHeader/Column based on the value in the same column in the <second> row.
    How can I accomplish the this requirement? (this must be applied for all the columns)
    Thanks

    Hi Fasttrck2,
    Per my understanding that you want to specify the background color of all the columns/column header based on the value in one special column of the special row, right?
    I have tested on my local environment and you can add expression to condition show the background color in the columns properties or the column header properties.
    Details information below for your reference:
    Specify the background color in the Column header: you can select the entire column header row and in the properties add expression in the Background color :
    If you want to specify the background color for the entire column, you can select the entire column and add the expression, repeat to add background color for other columns.
    If you want to specify the background color based on the value in the specific columns and row, you can create an hidden parameter to get the list of values from the  specific column, specify the Available values and default values by select "Get
    values from a query", finally using the expression as below to get the specific value you want:
    Expression(Backgroud Color):
    =IIF(Parameters!Para.Value(1)="1221","red","yellow")
    If your problem still exists, please try to provide some smaple data of the report and also the snapshot of the report structure to help us more effective to provide an solution.
    Any problem, please feel free to ask.
    Regards
    Vicky Liu
    If you have any feedback on our support, please click
    here.
    Vicky Liu
    TechNet Community Support

  • Defining a background color for a paragraph style

    Hello and please excuse this very basic question, but I am completely stumped.
    How do I simply define a background color for a paragraph style? I cannot use a table etc. because the styles are mapped during an XML conversion. Code lines should receive a gray background box to separate them from the text.
    Also, is there a way to force line breaks whithin words for a specific style? The text, formated in Courier, should just fill the space with a fixed width per character and break wherever the line ends.

    With some drawbacks it's doable using two paragraph tags.
    The first tag, e.g. "Line" is empty (no text), and it has a reference page graphic that's just a rectangle filled 100% with color and set to have a percentage tint so that the text will "show through" it.
    "Line" is also set to have a negative space below it, e.g. -12 points.
    "Code" paratag has the actual code text in it, and it's set to have a negative space above, e.g. -12 points.
    I've done projects where I have multiple Line paratags differing by the number of code lines needing to be shaded, e.g. Line1, Line2, Line3.
    Unfortunately there isn't a way to automatically have the line expand to the correct depth of the Code paragraph, although I believe this would probably be something that could be done as a Framescript, to run through a document and create new "line" paratags of the correct depth depending on how many Code paragraphs or lines are in the following paratag.

  • WorkOrderList TileView Row & Selected Row Background Color Change

    Hi,
         can we change the background color of WorkorderList TileView Row & Selected Row Background color ?. Actually i am trying to change the color of both in WorkOrderList but it not reflecting any color on my Agentry client. I used a style on Tile List View Data/Style.
    but these applied style on Rows & Selected Rows are not working in Agentry client.
    if any other alternate solution exist in Agentry, please guide me.
    i am using following...
      sap mobile platform-2.3.3
    Thanks & Regard
    Manish Kumar
    Tags edited by: Michael Appleby

    Hi Jason
          Yes using Image we can achieve that goal but i want to use a background color instead of Image background. Finally I used a background color on label and set the that label field on Screen. And It's showing the background color on WorkOrderList Row & Selected Row that what i wanted. But on both Row & Selected TileView Screen showing white outline that i don't want and also i could not remove the default Selected Blue Background Color.
         Please guide me how to remove white outline and default Blue Selected Background color.
    Thanks & Regard
    Manish Kumar

  • AdvancedDataGrid Row background color

    Hope someone can help, I wish to highlight an entire row or rows that match a value. I assumed the stylefunction would get me there but I have not found the style refering to the row background color.
    Any help please.
    Thank You

    The solution I found was to extend the data grid class, add override to the draw background and add a rowcolorfunction. When using item renderers you must use the style function with the alternatingItemColors so the renderer gets the color correct and not opaque.
    Thanks looking saisri2k2.

  • Advanceddatagrid grouped row background color

    Hi All,
    How to create a grouped row background color in advancedatagrid eg:
    Features
    Product 1
    Product 2
    Group1
       aa
    copy
    copy
       aa
    copy
    copy
    Group 2
       bb
    copy
    copy
       bb
    copy
    copy
    Thanks,
    srinath

    The solution I found was to extend the data grid class, add override to the draw background and add a rowcolorfunction. When using item renderers you must use the style function with the alternatingItemColors so the renderer gets the color correct and not opaque.
    Thanks looking saisri2k2.

  • Grey out a particular row in ALV based on some condition.

    Hi All,
    How can we grey out the particular row in ALV based on some condition( I am using the function modules and not OOPS).
    Regards
    Ramesh.

    Hello Ramesh
    In this case you need to add a specific field to your structure:
    TYPES: BEGIN OF ty_s_outtab.
    INLCUDE TYPE <my table or structure>.
    TYPES: CELLTAB   TYPE lvc_t_styl.  " name is arbitrary but this one is most frequently used
    TYPES: END OF ty_s_outtab.
    DATA: gt_outtab  TYPE STANDARD TABLE OF ty_s_outtab
                                 WITH DEFAULT KEY.
    You can use the fieldcatalog to make an entire column non-editable (LVC_S_FCAT-EDIT = ' ' ).
    However, in case of rows you need to inactivate all cells of this row. For sample coding please refer to thread:
    How to conditionally set ALV field as hotspot
    Regards
      Uwe

  • ADF Table row background color change ???

    Hi All
    i got below sql view object
    SELECT DEPARTMENT_ID,JOB_ID,COUNT(*) FROM EMPLOYEES GROUP BY DEPARTMENT_ID,ROLLUP(JOB_ID)
    By using this i will get each department_id, jobid's and total employes count in each department
    and i will get rollup for each departments ie i will get total employees.
    So i want to change the back ground of the total row.
    DepartmentId     JobId     Count1
    SA_REP 1
    1
    10     AD_ASST     1
    10     1 < this row in RED back ground in JSF page
    20     MK_MAN     1
    20     MK_REP     1
    20     2 < this row in RED back ground in JSF page
    30     PU_MAN     1
    30     PU_CLERK     5
    30     6< this row in RED back ground in JSF page
    40     HR_REP     1
    40     1< this row in RED back ground in JSF page
    50     ST_MAN     5
    50     SH_CLERK     20
    50     ST_CLERK     20
    50     45< this row in RED back ground in JSF page
    any kind of help is welcome...
    thanks
    Ravi

    Hi,
    you can do this by setting the background color of the outputText component that is the cell component e.g. in a read only table. Use the inlineStyle property to set the background-color but get the string from a managed bean. For each row you get a call to the managed bean and you can use JSF value binding
    FacesContext.getCurrentInstance().getApplication().createValueBinding()
    to access #{row} so that you can determine the value of a row column. Based on this you return a color
    Frank

  • JTable row background change - based on EXTERNAL event

    Greetings folks!
    I'm hoping for some help with a JTable issue. Here's the scenario:
    The app is a point of sale application. The user scans or manually adds an item to the order, which causes a row to appear in the JTable displaying description, price, quantity, etc. The user can then right click a row on the JTable and select an option from the popup menu. If the user selects one of the options, I want to be able to change the background color on that row.
    EVERYTHING I've seen online and researching is based on adding a custom renderer to the jtable which changes the background based on the data in the row. In my case there isn't anything in the row which changes... hence the point of changing the color.
    What I'm looking for is a method which will let me change the background of row x. I'm guessing there isn't a way. I'm hoping someone has a suggestion.
    Thanks in advance,
    John E.
    PS: I'm fairly new to java and working with inherited code, so please no 'you need to redesign the world' type answers unless there's an easier way. :)

    In my case there isn't anything in the row which changesThen how is the table going to know what color to paint the row? Remember painting the row is a dynamic process. You can't just paint it once. You need the ability to repaint the row if for example the table is scrolled and the row is now longer present. Then when the table scrolls again and the row is present you need to be able to repaint the row in your specified color. This means you need some way to tell the table what color the row should be. Which means you need to keep that information somewhere.
    One way to do this is to store the data in the TableModel that indicates that this row should be painted a "different" color. Then your situation is like the examples you have found. You now have some data you can test. This column does not need to be visible in the table since you can remove the TableColumn from the TableColumnModel so the column is not painted.
    Here is a simple posting that shows a better approach to painting row backgrounds withouth using a renderer:
    http://forum.java.sun.com/thread.jspa?forumID=57&threadID=610474

  • WAD - Portal - Changing row background colors

    Hi,
    We are creating web templates and posting to portal 6.0. I would like to know how to change the background colors for the rows for the output of the analysis item. Right now the default colors are grey and white (alternating rows). I did a search in the forum and it appears that there is no straightforward way to do it, with some suggesting we do it directly in the portal. Can someone provide detailed step by step instructions on how to change the background colors for rows for query output.
    Thanks,
    Anita S.

    You can modify the CSS (Cascading Style Sheet) in either Portal or WAD.  If you change it in Portal, it will be global for all reports viewed in the portal.
    For WAD, there is a general template parameter which contains the path to the .CSS file.  This CSS file is located in the Mime Repository (SE80).  Make the change to the css file in the mime repository and you're good to go.
    If you change the Portal CSS file, there is a wizard that can help you define colors for tables and preview them.

  • How to set background color based on values in column grouping

    Hello,
    I have query
    select 1 as CustomerID,'Reality' as Type, 100 as Turnover
    UNION
    select 1 as CustomerID,'Budget' as Type, 120 as Turnover
    UNION
    select 2 as CustomerID,'Reality' as Type, 140 as Turnover
    UNION
    select 2 as CustomerID,'Budget' as Type, 120 as Turnover
    I have matrix, where in rows are customers, there is columngroup based on field Type and in details are summaries of Turnover. I need to change background color of Reality field, when lower than Budget. How can I do that please ?

    Hi volyn,
    After testing the issue in my own environment, we can use custom code to achieve your requirement. For more details, you can refer to the following steps:
    Copy the custom code below and paste it to your report. (Right-click report>Report Properties>Code)
    DIM PreviousValue AS Decimal
    Dim CustomerID AS String = ""
    Public Function  GetPreviousValue(byval Val as Decimal, byval CusID as string)  as Decimal
    DIM Local_PreviousValue AS Decimal
    IF CustomerID <> CusID THEN
    CustomerID  = CusID 
    PreviousValue  = val
    Local_PreviousValue  = 0
    ELSE
    Local_PreviousValue =  val - PreviousValue 
    PreviousValue  = val
    END IF
    return Local_PreviousValue 
    End function
    Click the cell which contains [Sum(Turnover)] value, modify the expression of BackgroundColor property to like this in the Properties Window: 
    =iif(Code.GetPreviousValue(Fields!Turnover.Value,Fields!CustomerID.Value)<0,"Brown","White")
    In this scenario, you can change Brown color to any color you like. The following screenshot is for your reference (I added some data to make it more clearly):
    If you have any other questions, please feel free to ask.
    Thanks, 
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Every other row (background color)

    I want to keep it simple and in css.  How can I get this to work properly so every other row has a yellowish background color with no gaps between the words.
    This is what I have but its producing an odd result.
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    <style type="text/css">
        margin: 0px;
        padding: 0px;
    div#footer{
        height:auto;
        background-color:green;
        clear:both;
        font-size:14px;
        width:800px;
    div#footer ul{
            margin:0;
            padding:0;
            list-style:none;
    div#footer li{
        width:155px;
        display:inline-block;
        text-align:center;
        vertical-align: top;
    /* horizontal line breaks */
    hr {
        border: 0;
        color: #323232;
        background-color: #323232;
        height: 1px;
        width: 95%;
        text-align: center;
    .even {
        background-color: #FF9;
    </style>
    </head>
    <body>
    <div id="footer">
            <ul>
            <li class="even">01/15/2011</li>
            <li class="even">Broadway Brewhouse</li>
            <li class="even">New Phila, OH</li>
            <li class="even">10pm</li>
            <li class="even">330-343-9231</li>
            <hr />
            <li>06/11/2011</li> <li>Edelwiess Inn</li> <li>Sugarcreek, OH</li> <li>10pm</li> <li>330-852-3750</li>    
            <hr />
            <li class="even">04/09/2011</li>
            <li class="even">Uhrichsville Moose Lodge (Open to the Public)</li>
            <li class="even">Uhrichsville, OH</li>
            <li class="even">TBD</li>
            <li class="even">740-922-9098</li>
            <hr />
            <li>01/15/2011</li> <li>Broadway Brewhouse</li> <li>New Phila, OH</li> <li>10pm</li> <li>330-343-9231</li>   
            </ul>
    </div>
    </body>
    </html>

    To create coloured backgrounds to every other row use this.
    #averages tr:nth-of-type(odd) {
      background-color:#ccc;
    Substitute the id of your table for mine and change the colour code to suit.

  • Table content hover, background color change

    How can I achieve this background color hover effect? Like the table on this page:
    http://uconn.edu/holiday/teams.html

    jr4292 wrote:
    How can I achieve this background color hover effect? Like the table on this page:
    http://uconn.edu/holiday/teams.html
    If you want all your links to have the same effect then put this code in your style sheet:
    a:hover {
        background:#73D5FC;
        border:1px solid #DDDDDD;
    Good luck.

Maybe you are looking for

  • OpenGL problems in photoshop cs5 64bit

    I have a nvidia GTX 550Ti graphics card with all available driver updates. Some features of openGL work without problem. The main problem I have is preview of animation with ray trace and export of finished animation. Niether will work. The preview w

  • External monitor flickers when scroll on the google stock chart in Safari

    Well, this sounds crazy but this is what is happening to my Retina, 15-inch, Late 2013 Macbook Pro. I can reproduce it. 1. Go to this page in Safari (Version 7.1 (9537.85.10.17.1)): https://www.google.com/finance?q=LQD&ei=nQQ_VPj1H4ebrAHP6oDYDQ 2. Sc

  • HT1386 some music will not sync back to ipod after restoring after update

    i backed up my itunes library to disk prior to updating to OS6 now certain songs will not sync back to ipod even though they were purchased from itunes Help Please

  • Multicolumn LOV with Images

    Hi, I've been searching for a solution for a multi-column lov that incorporates images for a product view selector. I came across Super LOV from SkillBuilders http://www.skillbuilders.com/webinars/webinar.cfm/61?title=Introducing%20SkillBuilders%20Or

  • How can I change background color in parameter box

    Hi all, I would like to change back ground color of parameters box  from blue to other color. where i have change? see attached screenshot. please help me  Thanks in advance for your support