How do I hide a table that has no data on ireport?
How do I hide a t开发者_运维百科able (not include in layout) that has no data?
If you have the table on its own band, what I typically do is set a print when condition on the band that only shows the data if any object in that band has data. Say your table is something like this:
item1 item2 item3
The print when expression would look something like this:
item1 != null || item2 != null || item3 != null
If you're referring to a subreport built using a collection, then I just check to make sure the collection isn't empty:
!subreportCollection.isEmpty()
Putting the print when condition on the band line hides the data, and causes the report to collapse the unused space.
精彩评论