Skip to main content



      Home
Home » Archived » BIRT » Table row highlight using API
Table row highlight using API [message #181226] Mon, 31 July 2006 04:15 Go to next message
Eclipse UserFriend
Originally posted by: emina.karic.dsek.lth.se

I've been trying to add highlight to my table using the API. So far I've
managed to get conditional rowhighlighting using the setOnCreate-method like
this:

detail
.setOnCreate("if( this.getRowData().getExpressionValue(1)%2 ==
0){this.style.backgroundColor = \"#eff3ff\";}");

But I can't seem to do the equivalent using highlight rules in styles. What
I want to do is add a highligt rule to my style, and be able to apply it to
multiple tables. Creating the style and adding it to design was simple
enough, but I can't seem to add the highlightrule to the style. How do I
accomplish this?

Thanks in advance
Emina
Re: Table row highlight using API [message #181667 is a reply to message #181226] Wed, 02 August 2006 03:46 Go to previous messageGo to next message
Eclipse UserFriend
Hi,
we wrote for our tables with dataset a table designer class. Which has a
method to add highlight rules. Now all tables show exactly equals.
The method contains following code:

PropertyHandle highlightHandle = detailRow.getPropertyHandle(
StyleHandle.HIGHLIGHT_RULES_PROP );
HighlightRule highLight = new HighlightRule();
highLight.setOperator( DesignChoiceConstants.MAP_OPERATOR_TRUE );
highLight.setTestExpression("row[0]%2 == 0");
highLight.setProperty(HighlightRule.BACKGROUND_COLOR_MEMBER, "#F7F9FA");
highlightHandle.addItem(highLight);

detailRow is a RowHandle.

For a non dataset table it seems that this is not working so we wrote
another table designer which sets the background color like this:

RowHandle detailRow = factory.newTableRow();
table.getDetail().add( detailRow );
if( rowCount % 2 == 0 )
detailRow.setProperty(HighlightRule.BACKGROUND_COLOR_MEMBER, "#F7F9FA");
rowCount++;

Kind regards
Stefan
Re: Table row highlight using API [message #182818 is a reply to message #181667] Fri, 04 August 2006 10:29 Go to previous message
Eclipse UserFriend
Originally posted by: emina.karic.dsek.lth.se

Thanks a bunch. Worked like a charm.
Emina

"Stefan Biermann" <biermann@inxmail.de> wrote in message
news:eapl8c$vh2$1@utils.eclipse.org...
> Hi,
> we wrote for our tables with dataset a table designer class. Which has a
> method to add highlight rules. Now all tables show exactly equals.
> The method contains following code:
>
> PropertyHandle highlightHandle = detailRow.getPropertyHandle(
> StyleHandle.HIGHLIGHT_RULES_PROP );
> HighlightRule highLight = new HighlightRule();
> highLight.setOperator( DesignChoiceConstants.MAP_OPERATOR_TRUE );
> highLight.setTestExpression("row[0]%2 == 0");
> highLight.setProperty(HighlightRule.BACKGROUND_COLOR_MEMBER, "#F7F9FA");
> highlightHandle.addItem(highLight);
>
> detailRow is a RowHandle.
>
> For a non dataset table it seems that this is not working so we wrote
> another table designer which sets the background color like this:
>
> RowHandle detailRow = factory.newTableRow();
> table.getDetail().add( detailRow );
> if( rowCount % 2 == 0 )
> detailRow.setProperty(HighlightRule.BACKGROUND_COLOR_MEMBER, "#F7F9FA");
> rowCount++;
>
> Kind regards
> Stefan
Previous Topic:Error in evaluating script
Next Topic:Merge two rows into one?
Goto Forum:
  


Current Time: Tue Jul 15 10:53:18 EDT 2025

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

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

Back to the top