Class actuate.ViewerThe actuate.Viewer class retrieves and displays Actuate BIRT report contents in an HTML container. The actuate.Viewer class displays the report by page. The goto functions of this class change the current position and page displayed in the viewer.To assign the viewer to display in a <div id='containerName' /> tag on the page, use the following constructor call:Table 4-47 lists actuate.Viewer functions.
Table 4-47 getId( ) Returns the Actuate web application URL that this Viewer accesses Returns the bookmark of a Reportlet displayed in the viewer getText( ) Returns a Viewer object containing the given bookmarked element Goes to the position in the report specified by the bookmark Returns whether interactive viewing features are enabled Sets the parameters to run a report using a list of literal string pairs Sets the parameters to run a report using a generated object setSize( ) Sets the Scalable Vector Graphic support flag to enable Scalable Vector Graphics content submit( ) Submits all the asynchronous operations that the user has requested on this Viewer and renders the viewer component on the pageDisables the Interactive Viewer features of this Viewer object. This is an asynchronous setting committed by submit( ).myViewer.disableIV(function alertUser( ){alert("IV disabled");});void Viewer.downloadReport(string format, string pages, actuate.viewer.RenderOptions renderoption)Exports the report with a specified format. The downloadReport function does not return any object. The report is exported to the client side. Then the browser opens a download window for the user to specify a location for the report.String. The format in which to export the report. Valid values and their corresponding formats are:String. The pages to retrieve. Indicate page ranges by using the first page number of the range and the last page number separated by a dash. To use more than one value, separate individual page numbers or page ranges with commas.actuate.viewer.RenderOptions object. Optional. Sets the rendering options for the download, which currently only applies to multisheet xls format reports.Gets all the data from the report as specified by the request. This function makes an AJAX call to the server for the data that is not in the current page. Write a callback function to process the result set. The callback must take an actuate.data.ResultSet object as an argument.actuate.data.Request object. The request to generate the result set.Function. The callback function to call after retrieving the results. The callback function must take an actuate.data.ResultSet object as an argument.This example creates an actuate.data.ResultSet object from the report in myViewer as specified by myRequest and passes it to a callback function:Enables interactive viewing features for this Viewer, which enables the selection and modification of report content. This function must be used in the callback of viewer.submit( ) as shown in the following example:myviewer.setReportName("/Public/BIRT and BIRT Studio Examples/Sales by Customer.rptdesign");This function must be used in the callback of viewer.submit( ) as shown in the following example:myviewer.setReportName("/Public/BIRT and BIRT Studio Examples/Sales by Customer.rptdesign");To reset the viewer height to 20 pixels less than the browser window if it is larger than the browser window, use code similar to the following:if(myViewer.getClientHeight( ) < myViewer.getHeight( )){To reset the viewer width to 20 pixels less than the browser window if it is larger than the browser window, use code similar to the following:if(myViewer.getClientWidth( ) < myViewer.getWidth( )){void Viewer.getContentByBookmark(string bookmark, string format, function callback)Function. Callback to be called once the operation is finished. The callback must take actuate.data.ReportContent object as an argument.void Viewer.getContentByPageRange(string PageRange, string format, function callback)Function. Callback to be called once the operation is finished. The callback must take actuate.data.ReportContent object as an argument.Integer or Object. An integer indicates the same margin on all sides, in pixels. The object contains the pixel values for the top, bottom, left, and right margins of the viewer in an array. For example, a 25-pixel top content margin and no margin in the other directions would be the object array {top:25, left:0, right:0, bottom:0}.To set the margin of the viewer newViewer to match the margin of myViewer, use code similar to the following:Returns the report content displayed in the viewer. This function is the entry point for retrieving the report elements from this Viewer object.Use this function to access the bookmarks for specific elements in the page content. For example, to access the table "mytable" on the page loaded in the myViewer viewer object, use the following code:var element = myViewer.getCurrentPageContent( ).getTableByBookmark("mytable");This function is useful to move to another page relative to the current page. To go to the next page in a document, use the following code:To get the report data with the bookmark FirstDataItem and store it in the variable myDataItem, use code similar to the following:To get the Flash object with the bookmark FirstFlashObject and store it in the variable myFlashObject, use code similar to the following:To get the gadget with the bookmark FirstGadget and store it in the variable myGadget, use code similar to the following:Returns the URL of the help base. The help base is the base URL for the product help documentation.To get the label with the bookmark FirstLabel and store it in the variable myLabel, use code similar to the following:Returns the name of the report file, either a report design file or report document file, that is currently displayed in this Viewer.To get the table with the bookmark FirstTable and store it in the variable myTable, use code similar to the following:To get the Text object with the bookmark Title and store it in the variable myText, use code similar to the following:This function is useful to move to the last page of a document. To go to the last page in a document, use the following code:actuate.viewer.UIConfig object. This function returns null when no UIConfig object is set.var contentpane = viewer.getUIConfig( ).getContentPane( );actuate.viewer.UIOptions object. This function returns null when no UIOptions object is set.Returns a viewer object containing the report element that is associated with a bookmark or contained in an HTML element.actuate.Viewer object or null if the Viewer is not found.This example uses getViewer( ) to retrieve a report element and return the bookmark of the chart in that report:Goes to the page position by the specified bookmark. The viewer displays to the first page when the bookmark is not found.To move the viewer to the page position specified by the value of the 'bookmark' parameter, use this code:Returns the interactive viewing status of the viewer. Enables or disables the interactive viewing features with actuate.Viewer.enableIV( ).alert("Interactivity of this viewer is set to " + myViewer.isInteractive( ));Saves the current viewer content as a report design. The viewer must enable interactive viewing with enableIV( ) prior to saving a report design.String. Sets the name of the saved file. The current file name is used if null. The file name must be a path relative to the viewer’s repository.Function. Optional. The function to execute after the asynchronous call processing is done. The callback takes the current actuate.Viewer object as an input parameter.Saves the current viewer content as a report document. The viewer must enable interactive viewing with enableIV( ) prior to saving a report design.String. Sets the name of the saved file. The current file name is used if null. The file name must be a path relative to the viewer’s repository.Function. Optional. The function to execute after the asynchronous call processing is done. The callback takes the current actuate.Viewer object as an input parameter.To save the content of the viewer as the report document called NewDocument, use the following code:Array of strings or integer. Each member of the array is the margin for the top, left, right, and bottom internal margins for the viewer. An integer sets all margins to that value.To set the internal margin of the viewer to a 10-pixel buffer, use the following code:To set the height of the viewer to 600 pixels, use the following code:This example sets the help base URL to http://www.actuate.com/documentation/R11:Array of strings. Each string in the array is constructed of name:"value" pairs. Use a literal list, such as {param1:"value1", param2:"value2", … }.Array of actuate.parameter.ParameterValue objects. An array of this kind is returned by actuate.Parameter.downloadParameterValues( ) and is the recommended function for creating the parameters input.String. The bookmark ID used to render the Reportlet. Viewer requires a bookmark to render a Reportlet. Viewer does not support automatically generated generic bookmarks from a BIRT report.To open the Top 5 Customers Reportlet of the Customer Dashboard, set the Reportlet bookmark by name and then call viewer.submit, as shown in the following example:viewer.setReportName("/Public/BIRT and BIRT Studio Examples/Customer Dashboard.rptdocument");To open the Top 5 Sales Performers report, set the report by name and then call submit( ), as shown in the following example:viewer.setReportName("/Public/BIRT and BIRT Studio Examples/Top 5 Sales Performers.rptdesign");void Viewer.setService(string iPortalURL, actuate.RequestOptions requestOptions)Sets the target service URL to which this viewer links. When the service URL is not set, this Viewer links to the default service URL, which is set on the actuate object.String. The target Actuate web application URL, either a Java Component or Information Console.actuate.RequestOptions object. Optional. requestOptions defines URL parameters to send with the authentication request, such as the iServer URL, Encyclopedia volume, or repository type. The URL can also include custom parameters.myViewer.setService("http://localhost:8700/iportal", myRequestOptions);To set the viewer’s size to 300 pixels by 300 pixels, use code similar to the following:To disable Scalable Vector Graphic support for the myViewer viewer, use code similar to the following:actuate.viewer.UIOptions object. Enables or disables various controls and features.actuate.Constant.ViewingMode constant. Legal values are NON_DASHBOARD, DASHBOARD_NORMAL, and DASHBOARD_MAX.To set the width of the viewer to 800 pixels, use the following code:Updates and reloads the viewer after submitting requests for the viewer. The submit( ) function triggers an AJAX request for all asynchronous operations. When the server finishes the processing, it returns a response and the results are rendered on the page in the viewer container. Calling submit( ) when a previous submit( ) is pending throws an exception.Function. Optional. The function to execute after the asynchronous call processing is done.To open the Top 5 Sales Performers report, set the report by name and then call submit( ), as shown in the following example:viewer.setReportName("/Public/BIRT and BIRT Studio Examples/Top 5 Sales Performers.rptdesign");
|
|
Copyright Actuate Corporation 2012 |