Coloring a column

Hi,
I am trying to color the text of a column based on conditions. I have seen some examples, but they use the renderers.
I have a datagrid with a column that has a combobox as a component itemeditor, I want that column text to be colored based on conditions
<datagrid id="myGrid>
<columns>
<datagridcolumn headerText="project" dataField="project" />
<datagridcolumn headerText="status" dataField="status_type" itemEditor="statuscombobox" editorDataField="newValue" />
</columns>
</datagrid>
statuscombobox.mxml
<vbox>
<script>
</script>
<combobox id="cbStatus" />
</vbox>
I would like to have the text of column 'status' to be colored based on conditions and when clicked on the column, the combobox shows up (which need not be colored).
any suggestions
Thank you,

You can do that with headerStyleName property of DataGridColumn. Following code snippet will give you an idea how to use it.
    <mx:Style>
         .hColor{
              color: #ff0000;
    </mx:Style>
     <mx:DataGrid>
          <mx:columns>
               <mx:DataGridColumn headerStyleName="hColor" dataField="name"/>
          </mx:columns>
          <mx:dataProvider>
               <mx:Array>
                    <mx:Object name="A1"/>
                    <mx:Object name="A2"/>
                    <mx:Object name="A3"/>
                    <mx:Object name="A4"/>
               </mx:Array>
          </mx:dataProvider>
     </mx:DataGrid>

Similar Messages

  • Background color for column heading

    Hi,
    I have 5 columns in my report and I would like to have different background color for column headings. How can I do this in report templates?
    I was looking at Column heading section-
    <th class="t10ReportHeader"#ALIGNMENT# id="#COLUMN_HEADER_NAME#">#COLUMN_HEADER#</th>
    How can I specify backgrund colors for all columns here?
    Thanks in advance

    G'day Karen,
    Thanks for ur reply.
    I have seen this note before, its not that the header colors have changed after latest SP was applied in our systems. Also the ABAP and JAVA stacks are in sync.
    Scenario is that we are trying to set up a new Portal theme for Enterprise Reporting with some specific color codes (hex codes).
    What i have observed is Characterstics Header background color is set up using the element "Background Color of Level 1 Column Heading ".
    While the Background color for Key Figures header is using element "Background Color of Level 2 Column Heading ".
    But the problem is element "Background Color of Level 2 Column Heading " is also used as the Background color for Standard Characterstics cell, so if we make it same the whole report of the same color, which we dont want.
    Requirement is to get the same Background color for Header cells (both Char. and Key Figure headers).
    Any further suggestions will be appreciated.
    Thanks
    CK

  • How to change color of column in advanced table

    Hi Guys
    I need to change the color of column in advanced table.
    Please help me .
    Thanks
    Subramanian

    Hi
    Can you please give the sample code for this
    I created advancedtable
    under this advancedtable , I created columngroup
    under this columngroup
    I created column1 and column2
    Here I need change the color for entire column1.
    Thanks
    Subra

  • DataGrid alternating row colors per column

    Is there a way to set different alternating colors to each
    column in a DataGrid. I have a datagrid where I want two of the
    columns to have different alternating row colors, one column (red
    and light red) and the other (green and light green).
    Many thanks

    You can simply set the DataGridColumn property to the
    approprate colors.
    ex.
    <mx:DataGrid y="0" x="0" width="100%">
    <mx:columns>
    <mx:DataGridColumn id="col1" backgroundColor="0x640000"
    dataField="col1"/>
    <mx:DataGridColumn id="col1" backgroundColor="0xFF0000"
    dataField="col1"/>
    <mx:DataGridColumn id="col1" backgroundColor="0x006600"
    dataField="col1"/>
    <mx:DataGridColumn id="col1" backgroundColor="0x33CC33"
    dataField="col1"/>
    </mx:columns>
    </mx:DataGrid>
    or you can use the setStyle:
    col1.setStyle("backgroudColor", 0x640000)

  • Set Background color of columns in JTable

    Hi,
    I would like to set the background color of columns, which are not editable, to a grey color.
    I have a JTable with 8 columns where the first is not editable (set through a TableModel.
    Regards
    Thomas

    one can use a most efficient method of changing looks of table data by overidding prepareRenderer() method of JTable. this method returns a component which JTable uses to display a cell. a solution could be
    public class mytable extends JTable
       public component prepareRenderer(.......)
            component c = super.prepareRenderer(....);
             if ( not_my_column )
                return c;
            c.setBackground(Color.grey);
            return c;
    }

  • Coloring a column in report

    Hi,
    I am new to APex.
    I am trying to color a column in a report. I am using the <Td> tag. Something like
    <TD BGCOLOR="#00FF00">. It is coloring the cell as I want but it is coloring the next column and the values are posted in the next column. The whole table gets shifted to right from that column. I am using Apex3.0.
    I am using IE7, I don't know if that matters.
    Any help is appreciated.
    Thanks

    Vikas, thanks for the reply.
    "background-color:red" works but only for the text background. I want to color the whole cell in which the text is displayed. Please help.
    regards,
    VJ

  • Bring Color to  Column Headings of downloaded  ms-excel  file

    Hi,
    Iam downloading report output to MS-Excel sheet using  MS_EXCEL_OLE_STANDARD_DAT ...but what i want is how can i bring specific color to column heading of that downloaded Ms-excel file..

    using  ole  u  can  do it ...
    <b>just  copy  nad  paste  this  example...</b>&----
    *& Report  ZNEGI17                                                     *
    REPORT  ZNEGI17  NO STANDARD PAGE HEADING.
    this report demonstrates how to send some ABAP data to an
    EXCEL sheet using OLE automation.
    INCLUDE OLE2INCL.
    handles for OLE objects
    DATA: H_EXCEL TYPE OLE2_OBJECT, " Excel object
    H_MAPL TYPE OLE2_OBJECT, " list of workbooks
    H_MAP TYPE OLE2_OBJECT, " workbook
    H_ZL TYPE OLE2_OBJECT, " cell
    H_F TYPE OLE2_OBJECT. " font
    TABLES: SPFLI.
    DATA H TYPE I.
    table of flights
    DATA: IT_SPFLI LIKE SPFLI OCCURS 10 WITH HEADER LINE.
    *& Event START-OF-SELECTION
    START-OF-SELECTION.
    read flights
    SELECT * FROM SPFLI INTO TABLE IT_SPFLI UP TO 10 ROWS.
    display header
    ULINE (61).
    WRITE: / SY-VLINE NO-GAP,
    (3) 'Flg'(001) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
    (4) 'Nr'(002) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
    (20) 'Von'(003) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
    (20) 'Nach'(004) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
    (8) 'Zeit'(005) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP.
    ULINE /(61).
    display flights
    LOOP AT IT_SPFLI.
    WRITE: / SY-VLINE NO-GAP,
    IT_SPFLI-CARRID COLOR COL_KEY NO-GAP, SY-VLINE NO-GAP,
    IT_SPFLI-CONNID COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP,
    IT_SPFLI-CITYFROM COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP,
    IT_SPFLI-CITYTO COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP,
    IT_SPFLI-DEPTIME COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP.
    ENDLOOP.
    ULINE /(61).
    tell user what is going on
    CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
    EXPORTING
    PERCENTAGE = 0
    TEXT = TEXT-007
    EXCEPTIONS
    OTHERS = 1.
    start Excel
    CREATE OBJECT H_EXCEL 'EXCEL.APPLICATION'.
    PERFORM ERR_HDL.
    SET PROPERTY OF H_EXCEL 'Visible' = 1.
    CALL METHOD OF H_EXCEL 'FILESAVEAS' EXPORTING #1 = 'c:\kis_excel.xls'
    PERFORM ERR_HDL.
    tell user what is going on
    CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
    EXPORTING
    PERCENTAGE = 0
    TEXT = TEXT-008
    EXCEPTIONS
    OTHERS = 1.
    get list of workbooks, initially empty
    CALL METHOD OF H_EXCEL 'Workbooks' = H_MAPL.
    PERFORM ERR_HDL.
    add a new workbook
    CALL METHOD OF H_MAPL 'Add' = H_MAP.
    PERFORM ERR_HDL.
    tell user what is going on
    CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
    EXPORTING
    PERCENTAGE = 0
    TEXT = TEXT-009
    EXCEPTIONS
    OTHERS = 1.
    output column headings to active Excel sheet
    PERFORM FILL_CELL1 USING 1 1 1 'Flug'(001).
    PERFORM FILL_CELL1 USING 1 2 0 'Nr'(002).
    PERFORM FILL_CELL1 USING 1 3 1 'Von'(003).
    PERFORM FILL_CELL1 USING 1 4 1 'Nach'(004).
    PERFORM FILL_CELL1 USING 1 5 1 'Zeit'(005).
    LOOP AT IT_SPFLI.
    copy flights to active EXCEL sheet
    H = SY-TABIX + 1.
    PERFORM FILL_CELL USING H 1 0 IT_SPFLI-CARRID.
    PERFORM FILL_CELL USING H 2 0 IT_SPFLI-CONNID.
    PERFORM FILL_CELL USING H 3 0 IT_SPFLI-CITYFROM.
    PERFORM FILL_CELL USING H 4 0 IT_SPFLI-CITYTO.
    PERFORM FILL_CELL USING H 5 0 IT_SPFLI-DEPTIME.
    ENDLOOP.
    changes by Kishore - start
    CALL METHOD OF H_EXCEL 'Workbooks' = H_MAPL.
    CALL METHOD OF H_EXCEL 'Worksheets' = H_MAPL." EXPORTING #1 = 2.
    PERFORM ERR_HDL.
    add a new workbook
    CALL METHOD OF H_MAPL 'Add' = H_MAP EXPORTING #1 = 2.
    PERFORM ERR_HDL.
    tell user what is going on
    SET PROPERTY OF H_MAP 'NAME' = 'COPY'.
    CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
    EXPORTING
    PERCENTAGE = 0
    TEXT = TEXT-009
    EXCEPTIONS
    OTHERS = 1.
    output column headings to active Excel sheet
    PERFORM FILL_CELL1 USING 1 1 1 'Flug'(001).
    PERFORM FILL_CELL1 USING 1 2 0 'Nr'(002).
    PERFORM FILL_CELL1 USING 1 3 1 'Von'(003).
    PERFORM FILL_CELL1 USING 1 4 1 'Nach'(004).
    PERFORM FILL_CELL1 USING 1 5 1 'Zeit'(005).
    LOOP AT IT_SPFLI.
    copy flights to active EXCEL sheet
    H = SY-TABIX + 1.
    PERFORM FILL_CELL USING H 1 0 IT_SPFLI-CARRID.
    PERFORM FILL_CELL USING H 2 0 IT_SPFLI-CONNID.
    PERFORM FILL_CELL USING H 3 0 IT_SPFLI-CITYFROM.
    PERFORM FILL_CELL USING H 4 0 IT_SPFLI-CITYTO.
    PERFORM FILL_CELL USING H 5 0 IT_SPFLI-DEPTIME.
    ENDLOOP.
    changes by Kishore - end
    disconnect from Excel
    CALL METHOD OF H_EXCEL 'FILESAVEAS' EXPORTING #1 = 'C:\SKV.XLS'.
    FREE OBJECT H_EXCEL.
    PERFORM ERR_HDL.
    FORM FILL_CELL *
    sets cell at coordinates i,j to value val boldtype bold *
    FORM FILL_CELL1 USING I J BOLD VAL.
    data : color(5) type x value 'H80000008'.
    CALL METHOD OF H_EXCEL 'Cells' = H_ZL EXPORTING #1 = I #2 = J.
    PERFORM ERR_HDL.
    SET PROPERTY OF H_ZL 'Value' = VAL .
    PERFORM ERR_HDL.
    GET PROPERTY OF H_ZL 'Font' = H_F.
    PERFORM ERR_HDL.
    SET PROPERTY OF H_F 'Bold' = BOLD .
    PERFORM ERR_HDL.
    SET PROPERTY OF H_F 'ColorIndex' = 3 .
    PERFORM ERR_HDL.
    ENDFORM.
    *& Form ERR_HDL
    outputs OLE error if any *
    --> p1 text
    <-- p2 text
    FORM ERR_HDL.
    IF SY-SUBRC <> 0.
    WRITE: / 'Fehler bei OLE-Automation:'(010), SY-SUBRC.
    STOP.
    ENDIF.
    ENDFORM. " ERR_HDL
    *&      Form  FILL_CELL1
          text
         -->P_H  text
         -->P_1      text
         -->P_0      text
         -->P_IT_SPFLI_CARRID  text
    form FILL_CELL  using   I J BOLD VAL.
    CALL METHOD OF H_EXCEL 'Cells' = H_ZL EXPORTING #1 = I #2 = J.
    PERFORM ERR_HDL.
    SET PROPERTY OF H_ZL 'Value' = VAL .
    PERFORM ERR_HDL.
    GET PROPERTY OF H_ZL 'Font' = H_F.
    PERFORM ERR_HDL.
    endform.                    " FILL_CELL1

  • How to change colors of columns in a chart view

    Hi experts,
    I've a chart view which chart type is column. I have put 3 data series and I want to change the colors of them.
    By default, the 3 columns are displayed in blue, green and yellow and I wish put them in green, orange, and red. Is it possible?
    I've tried to change the color scheme but I have only 3 propositions (Straight, Reverse and Snake) that not correspond to my wish.
    Any idea?
    Thanks for help
    Ronan

    Hi Kiran,
    no its not possible through Theme editor also ,because these colors are coming from Compiler which u are using.
    Regards,
    Govindu

  • Using HTML,how to change the color of column data in an interactive report?

    Hi,
    I want to change the color of data of a column in an interactive report.
    I want to do it by HTML.
    I have tried the code
    <style type="text/css">
    #apexir_EMP_MANID{color:blue;}
    </style>
    But it changes the color of the heading of column only. Not the data.
    Plz can anyone suggest me something ?
    Thanks in advance

    Hi Vaibss!
    Is it that what you're looking for?
    Color Coding (Post number 5)
    regards

  • Colors in column

    Hi All,
    Wanted to know if I can give colors in a column:
    For eg if i have a column for number of projects (values from 1 to 100) Can I display another column where I could just give colors like 1- 25 projects red color, 26-50 blue. 51-75 green and 76-100 as yellow ...
    how to do this, I assume I will have to write a formula for color column but how . What would i call this technically?
    Thanks,
    Candie

    1.  Insert the project number in the report and then next to it insert a text box. 
    2.  Right click on the text box and then on Format Text.
    3.  In the pop up window, click on the Border tab and then on the x+2 button across from 'Background'.
    4.  In the formula workshop, type
    select {db.project.nbr}
    // {db.project.nbr} is the project number field
    case 1 to 25:
    crred
    case 26 to 50:
    crblue
    case 51 to 75:
    crolive
    case 76 to 100:
    craqua
    default:
    crnocolor;
    // change the color constants or use color codes as desired
    5.  Save and close.
    In the report the text box background should now change colors depending on the project number.
    Edited by: Sanjay Kodidine on Jun 2, 2010 1:25 PM

  • Interactive Report, issue with backgroud color of Column Heading.

    Hi,
    I am using Theme -16
    and there is a Interactive Report with the following columns Headings
    Employee Name   Employee No  DOB
    Now, the label of the first column is changed from Employee Name to Employee<br>name.
    The column heading is now displayed as follows.
    Employee   Employee No   DOB
    Name         problem is when I add a break in any of the column heading..the background color of the column headings is different than the first one (little bit darker).
    Why the background ground of the column heading is different in both these cases??.
    Thanks,
    Deepak

    Why the background ground of the column heading is different in both these cases??.The report heading background is controlled by the CSS rule
    .apexir_WORKSHEET_DATA th {
      background: #4e4e4e;
      font-weight: bold;
      color: #fff;
      border-top: 1px #ccc solid;
      border-bottom: 1px #aaa solid;
      white-space: nowrap;
      vertical-align: center;
      letter-spacing: 1;
      font-size: 8pt;
      background-image: url(../ws/report_bg.gif);
      background-repeat: repeat-x;
    }This uses a [gradient image|http://apex.oracle.com/i/ws/report_bg.gif] that is repeated horizontally to provide a shaded background from light to dark grey. As the background image doesn't repeat vertically, when the height of the heading is more than the height of the image the gradient is replaced by the underlying background colour (#4e4e4e). This is what's happening when the break is inserted into the header text: the height of the heading increases, causing more of the darker area of the background image/underlying colour to be visible.

  • Coloring a column in APEX

    Hi,
    How do we set the background color of a column in a report? I have four columns in the table and I want to display the data of each column with different color.
    Can you help?
    regards
    VJ

    Vikas, thanks for the reply.
    "background-color:red" works but only for the text background. I want to color the whole cell in which the text is displayed. Please help.
    regards,
    VJ

  • Color a column based on value in another column in tableview

    I am using a tableview iterator to display data in a bsp page. I want to color a cell in particular column (column 4), when a value in another column (column 2) on that same row is greater than 20. I can color the cell in column 2 but am not able to color the cell in column 4. How can I accomplish this?
    This is what I have. Looks like val1 is losing it's value.
    CASE p_column_index.
        WHEN 2.
          ASSIGN p_row_data_ref->* TO <row>.
          ASSIGN COMPONENT 'ZTGT' OF STRUCTURE <row> TO <col>.
          VAL = <col>.
          IF VAL GT '20'.
            val1 = p_row_index.
            p_style = 'celldesign:CRITICALVALUE_DARK'.
          ENDIF.
        WHEN 4.
            if p_row_index = val1.
              p_style = 'celldesign:CRITICALVALUE_DARK'.
            endif.
        WHEN OTHERS.
    do nothing
      ENDCASE.

    The reason val1 is "loosing its' value" is presumably because you have defined it in the method as a local variable. So each time you call the RENDER_CELL_START method it is is newly initialised. So if you make this an instance attribute it will retain its' contents across method calls.
    Cheers
    Graham Robbo

  • Changing color of columns in CL_GUI_CHART_ENGINE

    Dear Developers,
    I am displaying a Columns Graph using class CL_GUI_CHART_ENGINE. My requirement is to change color of selected columns based on their height. For example if height of the column exceepds 10, then the color of that particular color is to be made red. Is that possible using CL_GUI_CHART_ENGINE ??
    Thanks and Regards,
    kartik

    Hi,
          Refer below link:
    https://forums.sdn.sap.com/click.jspa?searchID=3958197&messageID=2474585
    <b>Reward points</b>
    Regards

  • Change colors of columns on horizonal axis

    Hello,I don't work with Excel a lot, usually when I get a request for something a couple times a year.Anything is possible, right? I've automated the creation of a pivot table and then the addition of the pivot chart. The problem I have is, I can't figure out how to change the column colors on the horizontal axis. Simple I know... I've been playing with properties in Excel to see where I'm missing code, but I can't make it work manually.Excel.Shape myChart = detailWS.Shapes.AddChart();
    closl

    This is the full method. First a chart is created that contains all the series.Then, then a new worksheet is created and the chart on the new worksheet contains only one of the series from the original chart. That is what the picture above displays.My question would be, are there layers of "series"? I tried to do in c# what you did above, but had a problem figuring it out.Excel.Range srcrange = ws.UsedRange;
    srcrange.Copy(Type.Missing);
    //opening of the second worksheet and pasting
    Excel.Range destrange = newSheet.Cells[1, 1];
    destrange.Select();
    newSheet.Paste(Type.Missing, Type.Missing);
    Excel.Shape myChart = newSheet.Shapes.AddChart();
    Excel.SeriesCollection seriesCollection = myChart.Chart.SeriesCollection();
    int index = 1;
    myChart.Chart.SetSourceData(newSheet.UsedRange, Type.Missing);
    myChart.Select();
    myChart.Height = 450;
    myChart.Width = 1500;
    //myChart.Name = sheetNumber.ToString();
    Excel.Series chartCategory = null;
    while(seriesCollection.Count > 1)
        chartCategory = seriesCollection.Item(index);               
        if (chartCategory.Name.Contains(name))
            chartCategory.IsFiltered = false;
            index = 2;
        else
            chartCategory.IsFiltered = true;
    if (chartCategory != null) Marshal.ReleaseComObject(chartCategory);
    closl

  • Change color of column background when entire column meets a condition

    I'm trying to create a report that visually indicates staffing coverage during certain hours. The report has the hours of the day as column headers, and for each person-row, a column can contain a 0 if that person is not scheduled for that hour, a 1 if one person is scheduled for that hour, or 2 if 2 people are scheduled for that hour, etc.<p>
    What I need is to show gaps in coverage, so I need to color red those columns where there are 0's for all rows in that particular column.<p>
    thanks!

    Couldn't you do this in the report SQL itself<BR><BR>The problem I see with this is that based on what she's asking (i.e. all rows in that column must be zero), you will not know if a column should be marked in red until after all of the rows have been retrieved and displayed. To do what you suggest, you'd have to run the report once to find columns that sum to zero, i.e.:<BR><BR>
    SELECT SUM(col1), sum(col2)...<BR>
    INTO v_sum_col1, v_sum_col2...<BR><BR>
    Then for any column with a sum of zero -- add in the code you suggest into the second SELECT to return the data, possibly with a DECODE twist:
    DECODE(v_sum_col1, 0, '&lt;span style="background-color:pink"&gt;0&lt;/span&gt;', col1)

Maybe you are looking for