Jump to content
Changes to the Jaspersoft community edition download ×

Dynamic report Columns issue

Recommended Posts

By: jasperkan - jasperkannan

Dynamic report Columns issue

2006-01-05 14:45

I need to dynamically show / hide some columns conditionally . I am setting the PrintWhen expresssion ,its working and the column is shown only when the condition is met. But the problem its leaving blank space instead of the column instead of realigning the subsequent columns !!!!!..so the whole point is lost !!.Could some one please help/suggest a way to overcome this ?


thanks a lot




By: jasperkan - jasperkannan

RE: Dynamic report Columns issue

2006-01-11 11:25

I think there is no way out for this as jasper uses absolute positioning and hence we wont be able to this in Jasper ????? .........i am wondering how others with similiare req: are managing ? in my case the client is very very speciific bt this feature. He doesnt want certain column to showup n the report based on selection criteria. Currently show/hide of a column works but jasper leaves empty space /white space in the place of that column insted of trimming it ....


ny pointers awaited...........



By: Teodor Danciu - teodord

RE: Dynamic report Columns issue

2006-01-11 11:57




This can only be achieved by dynamically building

report templates using the JasperReports API.

Or at least by altering report templates at runtime.

The columns have to be placed or moved in the

template using the API before running the report.


JasperReports cannot collapse empty space on the

horizontal axis because it would have no idea

about how you would want other elements to move

or adapt to the new layout. Maybe you want the

space to be redistributed to remaining columns

by increasing their width or who knows what.

And since report sections have a free-form layout

describing this whole behavior would be a pain

in itself.


So this is why such requirements could be solved

only by creating or modifying the report template



You can see how to create report templates using

the API if you look into the provided

/demo/samples/noxmldesign sample.


I hope this helps.





By: jasperkan - jasperkannan

RE: Dynamic report Columns issue

2006-03-07 12:51

Thanks Teo , i had a look at that sample and have customized our reports to include this feature .and its works perfectly fine. I am currently readinf through the JRBand and setting the width of those fields which are not to be shown by setting their width as 0 and setting the next column X cordinate to the hidden columns X cordinate.

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...