Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » How to set row background color from table cell value
How to set row background color from table cell value [message #1776055] Fri, 10 November 2017 07:55 Go to next message
Stefan Diener is currently offline Stefan DienerFriend
Messages: 2
Registered: November 2017
Junior Member
In a BIRT report I want to set the background color of a row depending on the value of one of the row's cell values.
I don't want to use conditions to choose a background color, I want to provide the background color itself from outside.

This is what I've done so far:

(1) Defined a variable called "bgColor". Provided a default value: "#FF0000".
(2) Defined a script to display the color of the table row in "onRender()":
this.getStyle().backgroundColor = vars["bgColor"];
(3) Defined a table column called "backgroundColor".
(4) Defined a script to get the color value of the table row in "onCreated()":
vars["bgColor"] = this.getRowData().getColumnValue("backgroundColor");

Unfortunately this does't work. I dont' see any background color at all (not even the default red color).

I already tried to define the table column as String (to provide values like "#4D92D9"), as well as Integer (to
provide values like the int value of 0x4D92D9). I also tried to provide the RGB values in three separate
columns (to provide values like 77, 146, 217) and to create a color using ColorDefinitionImpl.create(r,g,b).
None of it worked.

So all I'm missing is the correct assignment of the row value(s) to the variable. Probably I've overseen just a
minor detail? Can anybody put me in the right direction, please?

I'm using BIRT 4.6.
Re: How to set row background color from table cell value [message #1776221 is a reply to message #1776055] Tue, 14 November 2017 06:14 Go to previous message
Stefan Diener is currently offline Stefan DienerFriend
Messages: 2
Registered: November 2017
Junior Member
Meanwhile I encountered how to do it. Just forgot to update the data binding, so it was my own fault ;-)
Previous Topic:ReportDesignHandle.serialize doesn't throw IOException when no space
Next Topic:Time on X-axis in Line Charts
Goto Forum:
  


Current Time: Mon May 21 00:56:33 GMT 2018

Powered by FUDForum. Page generated in 0.01963 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top