Interactive scripting sample 1
The interactive viewer menu shown in Figure 8‑4 shows the following scripts changing interactive features:
*A script removes the user option to enable interactivity.
*A script removes the user option to export report content and data.
*A script enables interactivity when the BIRT design is viewed.
Figure 8‑4 Custom interactive viewer menu
The script written to change the toolbar menu appears in Listing 8‑1.
Listing 8‑1 Removing edit report and export options
// Get the Viewer's current UI Options
var uiOptions = this.getViewer().getUIOptions();
 
// Remove ability for user to export, extract,
// and change interactivity options
uiOptions.enableExportReport(false);
uiOptions.enableDataExtraction(false);
uiOptions.enableEditReport(false);
 
// Set the modified UI Options back into the Viewer
this.getViewer().setUIOptions(uiOptions);
 
// If Interactivity is not enabled, enable it
if (!this.getViewer().isInteractive())
this.getViewer().enableIV();