:: Forum >>

Programatically change header background not css

I would need to change a specific header's background color. I've seen some great examples but none that quite tell me what I need to do.

I try
obj.getHeaderTemplate().getContent("box").setStyle("background", "red");
or obj.getHeaderTemplate().setStyle("backgroundColor", "red");
but not working.

Can anyone help ?
Monday, September 17, 2007
You should specify the column index -

var header = obj.getHeaderTemplate(1); // column-1
header.getContent("box").setStyle("background", "red");
Alex (ActiveWidgets)
Monday, September 17, 2007
I try to specify the column index, but not working!! Why??
My Code:

    <title>ActiveWidgets Grid :: Examples</title>
    <style> body, html {margin:0px; padding: 0px; overflow: hidden;} </style>

    <link href="../../runtime/styles/xp/aw.css" rel="stylesheet" type="text/css" ></link>
    <script src="../../runtime/lib/aw.js"></script>
        var myData = [
            ["MSFT","Microsoft Corporation", "314,571.156", "32,187.000", "55000"]];
        var myColumns = [
            "Ticker", "Company Name", "Market Cap.", "$ Sales", "Employees"
    var obj = new AW.UI.Grid;

    var str = new AW.Formats.String;
    var num = new AW.Formats.Number;

    obj.setCellFormat([str, str, num, num, num]);



    obj.setSelectorText(function(i){return this.getRowPosition(i)+1});



    obj.onCellClicked = function(event, col, row){window.status = this.getCellText(col, row)};

var header = obj.getHeaderTemplate(1); // column-1
header.getContent("box").setStyle("background", "red");


Thursday, September 20, 2007
Somebody help me?
Monday, October 1, 2007
Can you explain what is wrong with this code? It does change the header color to red. Are you trying to do something else?
Alex (ActiveWidgets)
Monday, October 1, 2007
I upgraded aw.js from 2.01 to 2.02 version, that's working. Why?
Tuesday, October 2, 2007
There was a bug in 2.0.1 where changes on the inner content were not saved.
Alex (ActiveWidgets)
Wednesday, October 3, 2007

This topic is archived.

Back to support forum

Forum search