Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » expand collapse rows and export to PDF(export expanded/collapsed rows to PDF)
expand collapse rows and export to PDF [message #496651] Tue, 10 November 2009 19:19 Go to next message
Jim is currently offline JimFriend
Messages: 19
Registered: July 2009
Junior Member
Using the information provided in the following post,
Expand and Collapse Report Group
http://www.eclipse.org/forums/index.php?S=aa7b860c977f26e33e 668cf28f7a12ad&t=msg&th=120836
I have been able to generate a report in the Birt Viewer that allows sections of a report to be expanded/collapsed.

My question is how do I block the export of the collapsed sections when exporting to PDF (or other exports)? As it is right now, the entire report is expanded and displayed in the PDF.

I have tried to get the Display style settings for the rows in the onRender event of the row but have not been able to get that to work. I am thinking that there is a simple way to do this but I don't see it yet.

The goal is to present a report to a user in the BIRT Web Viewer. The user will then expand/collapse their desired report sections. Once the user has made their selections the user will export the report to PDF and only the users selections will be displayed on the PDF.

Any ideas would be greatly appreciated,

Jim



Re: expand collapse rows and export to PDF [message #499117 is a reply to message #496651] Thu, 19 November 2009 22:55 Go to previous messageGo to next message
Jim is currently offline JimFriend
Messages: 19
Registered: July 2009
Junior Member
The code below is an excerpt from the Expand Collapse Report Group example referred to in my first post. (A very nice example btw).

For my question, the situation is that the report has run and is being displayed in the Birt Viewer.

Here is my question:
In the code below, In the for loop that sets the display style, is there any way to set a row level variable that can be seen by the report row onRender event or by the row visibility property?

I am thinking that if I can set a variable that can be seen in either of these two places, I can set the visibility of the row when the report is exported to pdf.

Or, is it not possible to set a variable that is visible to the report from within script tags?


Thanks for any input on this.



The following code appears inside a text element on the Expand Collapse Report Group report example:

<form>
<script>
function hidetable(form, ord, rwcnt){

//alert( document.getElementById(ord).style.display );


var hide = false;
var btnstr = "mybutton"+ord;

if( document.getElementById(ord).style.display == 'block' ||
document.getElementById(ord).style.display == ""){
document.getElementById(ord).style.display = 'none';
document.getElementById(btnstr).value = "+";
//form.btnstr.value = "+";
hide = true;
testVar = -1;


}else{
document.getElementById(ord).style.display = 'block';
document.getElementById(btnstr).value = "-";
//form.btnstr.value = "-";
hide = false;
}
for( i=1; i<= rwcnt; i++ ){
var drow = ord+""+i;
if( document.getElementById(drow)){
if( hide ){
document.getElementById(drow).style.display = 'none';

}else{
document.getElementById(drow).style.display = 'block';


}
}
}



}

</script>

<INPUT Type="BUTTON"
name=<VALUE-OF>"mybutton"+row["ORDERNUMBER"]</VALUE-OF > Value="-"
onClick='hidetable( this.form, <VALUE-OF>row["ORDERNUMBER"]</VALUE-OF>,
<VALUE-OF>row["Aggregation"]</VALUE-OF> )'></INPUT>
<VALUE-OF>row["ORDERNUMBER"]</VALUE-OF>
<script>
hidetable( this.form, <VALUE-OF>row["ORDERNUMBER"]</VALUE-OF>,
<VALUE-OF>row["Aggregation"]</VALUE-OF> );
</script>

</form>
Re: expand collapse rows and export to PDF [message #499295 is a reply to message #499117] Fri, 20 November 2009 17:10 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Jim,

The problem is that approach for collapsing groups is done post render
and all on client side script. When you export to pdf it goes back to
the rptdocument and renders it, thus losing all the client side
interaction. One alternative may be to add a link to the report or
modify the export button to run a report that only shows the groups you
want. That way you could have a global js var set on the client side
that has all the groups you want to expose and you could use this in the
link to a new report. Just a thought.

Jason

Jim wrote:
> The code below is an excerpt from the Expand Collapse Report Group
> example referred to in my first post. (A very nice example btw).
>
> For my question, the situation is that the report has run and is being
> displayed in the Birt Viewer.
>
> Here is my question:
> In the code below, In the for loop that sets the display style, is there
> any way to set a row level variable that can be seen by the report row
> onRender event or by the row visibility property?
>
> I am thinking that if I can set a variable that can be seen in either of
> these two places, I can set the visibility of the row when the report is
> exported to pdf.
>
> Or, is it not possible to set a variable that is visible to the report
> from within script tags?
>
>
> Thanks for any input on this.
>
>
>
> The following code appears inside a text element on the Expand Collapse
> Report Group report example:
>
> <form>
> <script>
> function hidetable(form, ord, rwcnt){
>
> //alert( document.getElementById(ord).style.display );
>
>
> var hide = false;
> var btnstr = "mybutton"+ord;
>
> if( document.getElementById(ord).style.display == 'block' ||
> document.getElementById(ord).style.display == ""){
> document.getElementById(ord).style.display = 'none';
> document.getElementById(btnstr).value = "+";
> //form.btnstr.value = "+";
> hide = true;
> testVar = -1;
>
>
> }else{
> document.getElementById(ord).style.display = 'block';
> document.getElementById(btnstr).value = "-";
> //form.btnstr.value = "-";
> hide = false;
> }
> for( i=1; i<= rwcnt; i++ ){
> var drow = ord+""+i;
> if( document.getElementById(drow)){
> if( hide ){
> document.getElementById(drow).style.display = 'none';
>
> }else{
> document.getElementById(drow).style.display = 'block';
>
>
> }
> }
> }
>
>
>
> }
>
> </script>
>
> <INPUT Type="BUTTON"
> name=<VALUE-OF>"mybutton"+row["ORDERNUMBER"]</VALUE-OF > Value="-"
> onClick='hidetable( this.form, <VALUE-OF>row["ORDERNUMBER"]</VALUE-OF>,
> <VALUE-OF>row["Aggregation"]</VALUE-OF> )'></INPUT>
> <VALUE-OF>row["ORDERNUMBER"]</VALUE-OF>
> <script>
> hidetable( this.form, <VALUE-OF>row["ORDERNUMBER"]</VALUE-OF>,
> <VALUE-OF>row["Aggregation"]</VALUE-OF> );
> </script>
>
> </form>
Re: expand collapse rows and export to PDF [message #675422 is a reply to message #496651] Tue, 31 May 2011 13:39 Go to previous message
Shylendran C is currently offline Shylendran CFriend
Messages: 1
Registered: May 2011
Junior Member
Hi Jim,

Can you please let me know how did you implemented the Expand/Collapse feature using BIRT?

We were trying to get the best option to create a report with expand/collapse feature. Hope you can help me on this.

We were analyzing tools like JasperAnalysis and JasperServe, but these are not open software and these are complicated as well.

Thanks in Advance.

Thanks & Regards,
Shylendran.C
Previous Topic:Output based on Groups
Next Topic:Bar chart x-axis labels changed to letters after upgrade
Goto Forum:
  


Current Time: Sun Nov 23 12:37:17 GMT 2014

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

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