0

I am trying to create a generic style for all rows in my data table. I have been looking around and there seems to be a function I can use named rownum.

I tired to create the style like this...

row["__rownum"] Less than 0

then colour = Red

But this is not right. Can someone tell me the right way to do this so I can apply the style to multiple cells in my table.

Also where can i find documentation on what sort of functions like this are available?

thanks

Richie
  • 4,989
  • 24
  • 90
  • 177

1 Answers1

2

I know two ways how you can specify conditional styles in BIRT:

You can write an "onRender" eventHandler (either in Java or JavaScript) for your row. In JavaScript it could looks as follow:


    if (row["__rownum"] % 2 == 0) {
      this.getStyle().backgroundColor = "red";
    } else {
      this.getStyle().color = "red";
    }

Or create a new BIRT style with a highlight-rule like follows:


    row["__rownum"] % 2 equals to 0 then 
    Set Color or whatever or apply another style

Instead of creating a new style, that you will have to assign to target elements, you can also modify one of the predefined styles, if you find a one matching your targets.

Both EventHandler and Styles can be assigned to various element: Cells, Rows, Tables, Report...

Links you may find helpful:

Community
  • 1
  • 1
Vlad
  • 311
  • 1
  • 4
  • thanks Vlad. Appreciate the help. What you have posted is exactly what I have tried already. I will have to read some of your links to find out what i have done wrong – Richie Feb 22 '14 at 00:05