The ReportExplorer class generates an actuate.reportexplorer.eventconstants.ON_SELECTION_CHANGED event when the user selects a folder or file in the Report Explorer User Interface. To access the file information in this event, implement an event handler like the one shown in the following code:
The event passes the path and name of the file in the second parameter of the handler, pathName. To access the file, the event handler stores the path in a global variable, file.
In this implementation, the file path is updated each time a file selected. To open the file currently selected, implement a button on the page that runs a separate function that opens the file. The following code example shows a button that calls the custom displayReport( ) function, which attempts to open the file using an actuate.viewer object:
var viewer = new actuate.Viewer("explorerpane");
viewer.setReportName(file);
alert("Selected file is not viewable: " + file);
"http://www.w3.org/TR/html4/strict.dtd">
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<title>Report Explorer Page</title>
<script type="text/javascript" language="JavaScript" src="http://localhost:8700/iportal/jsapi"></script>
<script type="text/javascript" language="JavaScript">
actuate.load("reportexplorer");
requestOpts = new actuate.RequestOptions( );
actuate.initialize( "http://localhost:8900/iportal",requestOpts, null, null, runReportExplorer);
function runReportExplorer( ) {
var explorer = new actuate.ReportExplorer("explorerpane");
explorer.registerEventHandler( actuate.reportexplorer.EventConstants.ON_SELECTION_CHANGED, selectionChanged );
explorer.setFolderName( "/Public" );
var resultDef = "Name|FileType|Version|VersionName|Description";
explorer.setResultDef( resultDef.split("|") );
function selectionChanged( selectedItem, pathName ){
function displayReport( ){
var y = document.getElementById('explorerpane'), child;
while(child=y.firstChild){
var viewer = new actuate.Viewer("explorerpane");
viewer.setReportName(file);
alert("Selected file is not viewable: " + file);