Class actuate.report.Gadget
Description
A container for a Flash gadget object in a report. The Gadget class provides functions to operate on a Flash gadget object, such as retrieving content and getting the HTML DOM element from the report Flash element.
Constructor
The Gadget object is constructed by viewer.PageContent.getGadgetByBookmark( ).
Function summary
Table 44‑29 lists actuate.report.Gadget functions.
Table 44‑29 actuate.report.Gadget functions
Function
Description
Removes filters from this gadget
Returns the bookmark name for this gadget
Returns the HTML element for this gadget
Returns the report element instance id
Returns the page content to which this element belongs
Returns the gadget’s element type, which is gadget
Hides this element
Adds filters to this gadget
Sets the gadget type
Resizes the gadget’s width and height
Shows this element
Applies changes made to this gadget
clearFilters
Syntax
void Gadget.clearFilters(string columnName)
Clears the filters of a given column.
Parameter
columnName
String. The name of the column from which to clear the filters.
Example
This example clears existing filters from the PRODUCTLINE column:
function resetFilter(myGadget){
myGadget.clearFilters("PRODUCTLINE" );
myGadget.submit( );
}
getBookmark
Syntax
string Gadget.getBookmark( )
Returns the bookmark of this Gadget element.
Returns
String. The gadget’s bookmark.
Example
This example displays the gadget’s bookmark in an alert box:
function alertBookmark(myGadget){
alert(myGadget.getBookmark( ));
}
getHtmlDom
Syntax
HTMLElement Gadget.getHtmlDom( )
Returns the HTML element for this gadget.
Returns
HTMLElement.
Example
This example displays the HTML DOM element for this gadget inside a red border:
function showHtmlDom(myGadget){
var domNode = myGadget.getHtmlDom( );
var box = document.createElement('div' );
box.style.border = '2px solid red' ;
var label = document.createElement('h2' );
label.innerHTML = 'The HTML DOM:' ;
box.appendChild(label);
box.appendChild(domNode);
document.body.appendChild(box);
}
getInstanceId
Syntax
string Gadget.getInstanceId( )
Returns the instance id of this report element.
Returns
String. The instance id.
Example
This example displays the instance ID of the report element in an alert box:
function showID(myGadget){
var elementID = myGadget.getInstanceId( );
alert (elementID);
}
getPageContent
Syntax
actuate.viewer.PageContent Gadget.getPageContent( )
Returns the page content to which this gadget belongs.
Returns
actuate.viewer.PageContent. report content.
Example
This example displays the viewer ID of the page content in an alert box:
function showViewID(myGadget){
var pageContent = myGadget.getPageContent( );
var pageViewerID = pageContent.getViewerId( );
alert (pageViewerID);
}
getType
Syntax
string Gadget.getType( )
Returns the report element type of this object, which is Gadget.
Returns
String. "Gadget".
Example
This example checks the report element type and displays an alert if the type is not "Gadget":
if (myGadget.getType( ) != "Gadget" ){
alert("Type mismatch, report element type is not Gadget" );
}
hide
Syntax
void Gadget.hide( )
Hides this element.
Example
Use hide( ) to hide a gadget, as shown in the following code:
setFilters
Syntax
void Gadget.setFilters(actuate.data.Filter[ ] filters)
Sets the given filters.
Parameter
filters
An array of actuate.data.Filter objects. The filter conditions to apply to this chart element.
Example
This example applies a filter to the gadget:
function newFilter(myGadget){
var filter = new
actuate.data.Filter("PRODUCTLINE" , "=" , "Trucks and Buses" );
var filters = new Array( );
filters.push(filter);
myGadget.setFilters(filters);
}
setGadgetType
Syntax
void Gadget.setGadgetType(string chartType)
Specifies the gadget type for the Gadget element. The chart type is a constant.
Parameter
chartType
String. The possible values are constants as listed below:
GADGET_TYPE_BULLET: Bullet gadget subtype
GADGET_TYPE_CYLINDER: Cylinder gadget subtype
GADGET_TYPE_LINEARGAUGE: LinearGauge gadget subtype
GADGET_TYPE_METER: Meter gadget subtype
GADGET_TYPE_SPARK: Spark gadget subtype
GADGET_TYPE_THERMOMETER: Thermometer gadget subtype
Example
To change the gadget type to a meter, use code similar to the following:
myGadget.setGadgetType(actuate.report.Gadget.GADGET_TYPE_METER);
setSize
Syntax
void Gadget.setSize(integer width, integer height)
Specifies the width and height of a gadget in pixels.
Parameters
width
Integer. The width in pixels.
height
Integer. The height in pixels.
Example
To set the gadget to a 300-by-300-pixel square area, use code similar to the following:
myGadget.setSize(300, 300);
show
Syntax
void Gadget.show( )
Shows this element.
Example
Use show( ) to reveal a hidden gadget, as shown in the following code:
submit
Syntax
void Gadget.submit(function callback)
Submits all the asynchronous operations for this gadget. Submit( ) 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 gadget container.
Parameter
callback
Function. The function to execute after the asynchronous call processing is done.
Example
This example clears existing filters from the PRODUCTLINE column and pops up an alert box:
function alertResetFilter(myGadget){
myGadget.clearFilters("PRODUCTLINE" );
myGadget.submit(alert("Filters Cleared" ));
}