We would like to realize a DrillDown functionality in JasperReports. The origin of our JasperReports is CrystalReports.
If the user clicks on a group heading in the viewer, the detail data records should be displayed or hidden. This is what our current solution looks like:
We use an already compiled report. We catch the group heading click with a hyperlink listener. Then a parameter for the display (type: ArrayList) is changed accordingly and the compiled report is completely recreated with an in-memory datasource. The JRViewer panel will be replaced by an updated panel. After that the previously displayed page will be displayed.
Who knows a better solution? Is it possible to optimize the complete rebuilding of the report? Is there a shortcut?
Usually our reports need a relational database. What's the best strategy to get an in-memory datasource? In our first attempt we developed a List/List/Map for the datasources/rows/fields. But it may be possible to get this with a SortField.
Java 8 / Swing / JasperReports 6.0.4 jar