Dynamic highlight of table cell [message #732328] |
Tue, 04 October 2011 14:17 |
harip kaligo 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 |
|
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);
|
|
|
Powered by
FUDForum. Page generated in 0.03061 seconds