3.2.0

Background color row / data

Good morning,

I'm French, and I have just discovered ActiveWidgets, it's amzing, Thank you for it !!

First, I'm sorru for my language, I know I make lot of mistckes when I write in English, but I'm learning !!

This is my problem... I would like to choose a color to each "continent"

<data>
- <record>
<rank>1</rank>
<country code="us">United States</country>
<users>205326680</users>
<year>2005</year>
<continent>america</continent>
</record>
- <record>
<rank>2</rank>
<country code="cn">China</country>
<users>123000000</users>
<year>2006</year>
<continent>Asia</continent>
</record>
- <record>
<rank>3</rank>
<country code="jp">Japan</country>
<users>86300000</users>
<year>2005</year>
<continent>Asia</continent>
</record>

...

- <record>
<rank>7</rank>
<country code="de">Germany</country>
<users>50616000</users>
<year>Europe</year>
</record>



Also, there are the five continents, how the choose a row color for each continents?
Devfr
October 28,
First, you'd want to disable the default style (or not enable them). These would be .aw-mouseover-row and .aw-rows-selected

Next, you'll need to write some JavaScript to set the colour. This code does it for the text colour of a cell -
obj.defineCellProperty("color")
        obj.setCellColor(function(col, row)
        {
            switch (col)
            {
            case 6:
                return this.getCellText(col, row).indexOf('text') == 0 ? "black" : "red"
            case 8:
                return this.getCellText(8, row).indexOf('some text') == 0 ? "red" : "black"
            }
            return "black"
        })
        obj.getCellTemplate().setStyle("color", function(){
            return this.getCellProperty("color")})

So it looks at the contents of columns 6 and 8 and sets the text colour of the column accordingly.

So, for the background colour of a row, you'd want to define a row property for the background, then set the row background colour based on the contents of your desired column by calling getRowTemplate().
Anthony
October 29,
Thank you very much Anthony !!
Devfr
October 31,
Hi,

I have try this but it does not work... Could you explain me ?
Thx
Juanita
October 31,

This topic is archived.

See also:


Back to support forum