Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Dynamic highlight of table cell(Dynamic highlight of table cell)
Dynamic highlight of table cell [message #732328] Tue, 04 October 2011 14:17 Go to next message
harip kaligo is currently offline harip kaligoFriend
Messages: 74
Registered: July 2011
Member
Hi,

We need to highlight a text in a table created dynamically.Below is the script we have in beforefactory().

With script we have we are not getting the cell highlighted.Please find the rptdesign file attached for reference.
we only need the text to be highlighted in the rptdocument generated.

Any help regarding this is appreciated. Thanks.


importPackage(Packages.org.eclipse.birt.report.model.api);
importPackage(Packages.org.eclipse.birt.report.model.api.elements);
importPackage(Packages.org.eclipse.birt.report.model.api.elements.structures);


elementFactory = reportContext.getDesignHandle().getElementFactory();
var mytable = reportContext.getDesignHandle().findElement("customReportTable");
var colbinds = mytable.getColumnBindings( );





hc = StructureFactory.createHighlightRule();
hc.setTestExpression("row[\" QUANTITYORDERED \"]");
hc.setValue1("30");
hc.setOperator("eq");
hc.setProperty(HighlightRule.BACKGROUND_COLOR_MEMBER, "blue");
phc = mytable.getPropertyHandle(StyleHandle.HIGHLIGHT_RULES_PROP);
phc.addItem(hc);

[Updated on: Tue, 04 October 2011 14:17]

Report message to a moderator

Re: Dynamic highlight of table cell [message #733399 is a reply to message #732328] Tue, 04 October 2011 15:37 Go to previous message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Put the highlight rule on the detail row, not the table:


importPackage(Packages.org.eclipse.birt.report.model.api);
importPackage(Packages.org.eclipse.birt.report.model.api.elements);
importPackage(Packages.org.eclipse.birt.report.model.api.elements.structures);


//delm =
reportContext.getReportRunnable().designHandle.getDesignHandle().findElement("QTYELEMENT");
elementFactory = reportContext.getDesignHandle().getElementFactory();
var mytable =
reportContext.getDesignHandle().findElement("customReportTable");
var detailSlot = mytable.getDetail( );
var rowd = detailSlot.get( 0 );

var colbinds = mytable.getColumnBindings( );



hc = StructureFactory.createHighlightRule();
hc.setTestExpression("row[\"QUANTITYORDERED\"]");
hc.setValue1("30");
hc.setOperator("eq");
hc.setProperty(HighlightRule.BACKGROUND_COLOR_MEMBER, "blue");
phc = rowd.getPropertyHandle(StyleHandle.HIGHLIGHT_RULES_PROP);
phc.addItem(hc);


Jason

On 10/4/2011 10:17 AM, kkp wrote:
> Hi,
>
> We need to highlight a text in a table created dynamically.Below is the script we have in beforefactory().
>
> With script we have we are not getting the cell highlighted.Please find the rptdesign file attached for reference.
> we only need the text to be highlighted in the rptdocument generated.
>
> Any help regarding this is appreciated. Thanks.
>
>
> importPackage(Packages.org.eclipse.birt.report.model.api);
> importPackage(Packages.org.eclipse.birt.report.model.api.elements);
> importPackage(Packages.org.eclipse.birt.report.model.api.elements.structures);
>
>
> elementFactory = reportContext.getDesignHandle().getElementFactory();
> var mytable = reportContext.getDesignHandle().findElement("customReportTable");
> var colbinds = mytable.getColumnBindings( );
>
>
>
>
>
> hc = StructureFactory.createHighlightRule();
> hc.setTestExpression("row[\" QUANTITYORDERED \"]");
> hc.setValue1("30");
> hc.setOperator("eq");
> hc.setProperty(HighlightRule.BACKGROUND_COLOR_MEMBER, "blue");
> phc = mytable.getPropertyHandle(StyleHandle.HIGHLIGHT_RULES_PROP);
> phc.addItem(hc);
Previous Topic:Dynamically attaching onCreate script
Next Topic:Announcing The Eclipse Fall 2011 Training Series
Goto Forum:
  


Current Time: Thu Mar 28 21:18:48 GMT 2024

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

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

Back to the top