The below example is created from the Classic Models, Inc. Sample Database, and designed roughly :). Only titled question is focused.
First Way: Very easy and simple:
After applying group:
1) Select Script tab and Set i = 0 in initiaze() method of report design.i could be any variable.
2. On the Layout tab of report select the Group header row (where you want to apply style) and then click on Script tab. Select onRender from Script drop down and write below script:
if (i==0) {
this.getStyle().backgroundColor = "silver";
i = 1;
}
else
{
this.getStyle().backgroundColor = "white";
i = 0;
}
That's all. Now run report.
For more: http://www.birt-exchange.org/org/devshare/designing-birt-reports/735-alternate-background-colors/#description
Second Way: A lengthy way:
Here is the one way to apply alternate row colors on the group headers in BIRT.
Below is the simple image of a Table having Customer Name, City, State, Order Number etc etc. Here Customers are being repeated because they have multiple Orders associated.Please note on below table (1.1) a highlight style is applied for alternate row.
Screen Shot 1.1 |
The reason of this is: Expression that is used is: if (row[0]+1)%2 = = 0 then highlight color will apply else NOT. And row[0] refers to the current row count of table,and the count of group main row and its first detail row is same, so its the reason of style disturbance.
Screen Shot 1.2 |
Below is one way to apply alternate row color style for group main rows:
Here we required to figure out the current group number. By row[0], we can not figure out group number.
Steps:
1. Double click on Data Set to Edit, then click on Computed Columns tab and then New to add a column:
Fill in the box as in the screen shot (1.3).
Screen Shot 1.3 |
2. Then go in Binding Tab of Table's Property Editor. Click on Add Aggregation button and fill in box as in screen shot 1.4. Please note, select the group name from Group drop down on which you want to apply alternate color style.
Screen Shot 1.4 |
3. Again click on Add Aggregation button and fill in as in Screen Shot 1.5.
Screen Shot 1.5 |
4. After step 3, select the Group Header row, and form the Property Editor click on the Highlights tab. Then click on add button.(Illustrated in 1.6)
Screen Shot 1.6 |
Screen Shot 1.7 |
6. Now run report, and see in figure 1.8 that groups are applied with proper alternate colors.
Screen Shot 1.8 |
This comment has been removed by the author.
ReplyDeletewhen i load report containing table in jsp page using AJAX then its takes some spaces between two rows. how i can control spaces between two rows of table in birt
ReplyDeleteManage the cell spaces in BIRT designer. try this and let me know if you still face the same issue.
Deletethank you so much this is very useful
ReplyDeleteit solved my problem perfectly
ReplyDeleteNice information, valuable and excellent design, as share good stuff with good ideas and concepts, lots of great information and inspiration, both of which I need, thanks to offer such a helpful information here. Apply Slotxo
ReplyDelete