Tutorial 6: Implementing the JSAPI in a web page to display a dashboard
This tutorial provides step-by-step instructions for authoring a web page to display a BIRT dashboard.
1 Using a code editor, open or create a JSAPITemplate.html file that contains the essential components for any web page that implements the JSAPI.
<!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>JSAPI Template</title>
</head>
<body onload="init( )">
<div id="sample">
<script type="text/javascript" language="JavaScript" src="http://127.0.0.1:8700/iportal/jsapi"></script>
<script type="text/javascript" language="JavaScript">
<!-- Insert code here -->
</script>
</div>
</body>
</html>
2 Navigate to the following line:
<title>JSAPI Template</title>
In title, change:
JSAPI Template
to:
Dashboard Display Page
3 Navigate to the following line:
<div id="sample">
In id, change:
sample
to:
dashboard
4 Navigate to the empty line after the following line:
<script type="text/javascript" language="JavaScript">
5 Add the following code:
function init( ){
var reqOps = new actuate.RequestOptions( );
reqOps.setRepositoryType(
actuate.RequestOptions.REPOSITORY_ENCYCLOPEDIA);
actuate.initialize("http://127.0.0.1:8700/iportal", reqOps, "administrator", "", displayDashboard);
}
function displayDashboard( ){
var mydashboard = new actuate.Dashboard("dashboard");
mydashboard.setDashboardName(
"/Dashboard/Contents/Documents.DASHBOARD");
mydashboard.submit();
}
6 Save the file as dashboarddisplay.html.
7 In Internet Explorer, open dashboarddisplay.html.
If you receive a security warning that Internet Explorer has restricted this page from running scripts or ActiveX controls that could access your computer, right-click on the message and select Allow Blocked Content.
If you receive a scripting error, choose OK. This error is generated by the Documents.DASHBOARD file, not dashboarddisplay.html.
If the dashboard does not finish loading, in Internet Explorer, choose ToolsInternet Options. Select the Privacy tab, then choose Advanced. Select “Override automatic cookie handling.” Choose Apply. Refresh the browser.