This example is actually the same report-design as displayed in this page, but this time:
- The toolbar is disabled through portlet preferences, because in this sample page we just want to show Excel exports
- A report parameter "displayHTML" is turned to false by default through portlet preferences. As a result the data-grid is not displayed anymore in the portlet window, it is replaced with a simple grid showing possible export actions.
- Although the data-grid is not displayed, it is still generated in background before we can export.
- In Eclipse designer, these export buttons are simple HTML text elements. For instance the first one is defined like this:
<button style="min-width:150px" class="btn btn-primary" onclick="visioneoManagerIPC.doExport('xlsx')" title="Excel 2010 (.xlsx)" type="button">Excel 2010</button>
Swiching between different views can be achieved by using Visibility property of BIRT elements. In this example we set visibilty on 2 grid elements in Eclipse designer:
- HTML format: Turn off the visibility of the data-grid when "displayHTML" parameter is false
- HTML format: Turn off the visibility of export-actions grid when "displayHTML" parameter is true
- All other formats: Turn off the visibility of export-actions grid
For advanced report developers:
In terms of performance, please notice using "visibility" is not as efficient as dropping BIRT elements by script in beforeFactory method, because elements are still generated even if they are hidden. In this sample that behavior is what we want because the data-grid has to be generated before we can export it to Excel. But in many situations such switching between the views of the economic report sample, dropping elements is a better option.