Using dashboards and gadgets
The actuate.Dashboard class loads and displays dashboards and provides access to the gadgets contained in dashboards. The Dashboard class requires a pre‑existing actuate.RequestOptions object with the repository type set loaded with initialize. To use the RequestOptions to access dashboard content residing in a volume, use the RequestOptions constructor, use setRepositoryType( ) to set the repository to encyclopedia, and provide the object as a parameter to the initialize call, as shown in the following code:
var reqOps = new actuate.RequestOptions( );
reqOps.setRepositoryType(
actuate.RequestOptions.REPOSITORY_ENCYCLOPEDIA);
actuate.initialize("http://127.0.0.1:8700/iportal", reqOps, null, null, runDashboard );
To use actuate.Dashboard, load the class with actuate.load( ) before initialize( ), as shown in the following code:
actuate.load("dashboard");
Load the dashboard a components to use the dashboard on the page. Call the actuate.Dashboard functions to prepare a dashboard and call the dashboard’s submit( ) function to display the contents in the assigned <div> element.
The actuate.Dashboard class is a container for a dashboard file. Create an instance of the class using JavaScript, as shown in the following code:
dashboard = new actuate.Dashboard("containerID");
The value of "containerID" is the name value for the <div> element that displays the dashboard content. The page body must contain a <div> element with the containerID id, as shown in the following code:
<div id="containerID"></div>
To set the dashboard file to display, use setDashboardName( ) as shown in the following code:
dashboard.setDashboardName("/sharedtab.dashboard");
The setReportName( ) function accepts the path and name of a report
file in the repository as the only parameter. In this example, "/public
/sharedtab.dashboard" indicates the shared tab dashboard in the /public directory.
To display the dashboard, call dashboard.submit( ) as shown in the following code:
dashboard.submit(submitCallback);
The submit( ) function submits all of the asynchronous operations that previous viewer functions prepare and triggers an AJAX request for the dashboard. The Actuate web application returns the dashboard and the page displays the dashboard in the assigned <div> element. The submitCallback( ) callback function triggers after the submit operation completes.
This is a complete example that displays a dashboard:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type"
content="text/html;charset=utf-8" />
<title>Dashboard Page</title>
</head>
<body onload="init( )">
<div id="dashboardpane">
<script type="text/javascript" language="JavaScript"
src="http://127.0.0.1:8700/iportal/jsapi"></script>
 
<script type="text/javascript" language="JavaScript">
function init( ){
actuate.load("dashboard");
var reqOps = new actuate.RequestOptions( );
reqOps.setRepositoryType(
actuate.RequestOptions.REPOSITORY_ENCYCLOPEDIA);
actuate.initialize("http://127.0.0.1:8700/iportal", reqOps, null, null, runDashboard );
}
function runDashboard( ){
var dash = new actuate.Dashboard("dashboardpane");
dash.setDashboardName("/sharedtab.dashboard");
dash.setIsDesigner(false);
dash.submit( );
}
</script>
</div>
</body>
</html>