Interactive scripting sample 2
The interactive context menu shown in Figure 8‑5 shows the following scripts changing interactive features:
*A script removes the user option to enable interactivity.
*A script removes the user option to filter, group, and aggregate values in the report.
*A script enables interactivity when the BIRT design is viewed.
Figure 8‑5 Custom interactive context menu
The script written to change the context menu appears in Listing 8‑2.
Listing 8‑2 Removing filter, group, and aggregation options
// Get the Viewer's current UI Options
var uiOptions = this.getViewer().getUIOptions();
 
// For security reasons, enable Interactive Viewer with only a
// fixed set of interactive functionality to the users.
 
//hide Enable/Disable Interactivity
uiOptions.enableEditReport(false); //hide interactivity option
uiOptions.enableGroupEdit(false); //hide move/add/delete Group
uiOptions.enablePageBreak(false); //hide page break
uiOptions.enableAggregation(false); //hide Aggregation
uiOptions.enableFilter(false); //hide Filter
// 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();