Actuate JavaScript API classes : Class actuate.Parameter

Class actuate.Parameter

Description

The actuate.Parameter class retrieves and displays Actuate BIRT report parameters in an HTML container. Users can interact with the parameters on the page and changes to the parameter values are passed to an actuate.Viewer object, not to the Server directly.

The actuate.Parameter class displays the parameters by page. The actuate.parameters.navigate( ) function changes the page display or changes the current position on the page.

Constructor

Syntax

actuate.Parameter(string container)

Constructs a Parameter object for a page, initializing the parameter component.

Parameters

container

String. The name of the HTML element that displays the rendered parameter component or a container object. The constructor initializes the parameter component but does not render it.

Function summary

Table 4-17 lists actuate.Parameter functions.

Submits all the asynchronous operations that the user has requested on this parameter object and renders the parameters component on the page.

actuate.Parameter.downloadParameterValues

Syntax

void Parameter.downloadParameterValues(function callback)

Returns an array of the actuate.parameter.ParameterValue objects for the Parameter object. If no values have been set, the parameter object downloads the default values from the server.

Parameters

callback

Function. The function to execute after the report parameters finish downloading. Parameter.downloadParameterValues( ) sends an array of actuate.parameter.ParameterValue objects to the callback function as an input argument.

Example

To download the parameter values and add them to the viewer, the callback function must use the values as an input parameter, as shown in the following code:

paramObj.downloadParameterValues(runNext);
function runNext(values){
  viewer.setParameterValues(values);
}

actuate.Parameter.getLayout

Syntax

string Parameter.getLayout( )

Returns the parameter layout type.

Returns

String. The parameter layout, which will match one of the layout constants in actuate.parameter.Constants:

n  
n  
n  

Example

This example calls getLayout( ) to display the parameter layout type in an alert box.

alert(paramObj.getLayout( ));

actuate.Parameter.getParameterGroupNames

Syntax

string[ ] Parameter.getParameterGroupNames( )

Returns all the group names for the parameter page as an array of strings.

Returns

Array of strings. Each string is a group name.

Example

This example displays an alert box with the name of the first group for the parameter page:

var groupNames = paramObj.getParameterGroupNames( );
alert("First Group Name: " + groupNames[0]);

actuate.Parameter.getReportName

Syntax

string Parameter.getReportName( )

Returns the name of the report file currently referenced by this Parameter object.

Returns

String.

Example

This example displays an alert box with the name of the report file:

alert("Report file: " + paramObj.getReportName( ));

actuate.Parameter.getTransientDocumentName

Syntax

string Parameter.getTransientDocumentName( )

Returns the name of the transient document generated by running the report currently referenced by this Parameter object.

Returns

String.

Example

This example displays an alert box with the name of the transient document:

alert("Transient document: " + paramObj.getTransientDocumentName( ));

actuate.Parameter.hideNavBar

Syntax

void Parameter.hideNavBar( )

Hides the navigation bar for the parameter component in the LAYOUT_GROUP layout.

Example

This example hides the navigation bar:

paramObj.hideNavBar( );
alert("Navigation bar is hidden");

actuate.Parameter.hideParameterGroup

Syntax

void Parameter.hideParameterGroup(string[ ] groupNames)

Hide all report parameters that belongs to a group or to a list of groups.

Parameters

groupNames

String or Array of strings. Hides any groups listed.

Example

This example hides the report parameters that belong to the groups that are listed in the myGroups string array:

var myGroups = ["Group1", "Group2", "Group3"];
paramObj.hideParameterGroup(myGroups);
alert("Groups are hidden");

actuate.Parameter.hideParameterName

Syntax

void Parameter.hideParameterName(string[ ] parameterNames)

Hide report parameters as specified by name.

Parameters

parameterNames

String or Array of strings.

Example

This example hides the parameters that are listed in the myParams string array:

var myParams = ["Parameter1", "Parameter2", "Parameter3"];
paramObj.hideParameterName(myParams);
alert("Parameters are hidden");

actuate.Parameter.navigate

Syntax

void Parameter.navigate(string containerId, string navTarget)

Changes the current page of the parameter component. The navTarget determines the new location to display the parameter container.

Parameters

containerId

String. The value of the id parameter for the HTML <div> element that holds the parameters component.

navTarget

String constant. Which navigation button to trigger. Possible values from actuate.parameter.Constants are NAV_FIRST, NAV_PREV, NAV_NEXT, NAV_LAST.

Example

This example displays the last page of the parameters component in the HTML <div> element with the myParams ID.

function myParamsLast(myParameter){
  myParameter.navigate("myParams", NAV_LAST);
}

actuate.Parameter.onUnload

Syntax

void Parameter.onUnload( )

Performs garbage collection for the parameter object and unloads JavaScript variables that are no longer needed by Parameter.

Example

This example unloads JavaScript variables and displays an alert box.

myParameter.onUnload;
alert("JS variables unloaded.");

actuate.Parameter.registerEventHandler

Syntax

void Parameter.registerEventHandler(actuate.parameter.EventConstants event, function handler)

Registers an event handler to activate for parameter events. This function can assign several handlers to a single event.

Parameters

event

actuate.parameter.EventConstants. A constant corresponding to a supported event. actuate.Parameter supports the following two events:
n  
n  

handler

Function. The function to execute when the event occurs. The handler must take two arguments: the parameter instance that fired the event and an event object specific to the event type.

Example

To register an event handler to catch exceptions, call actuate.Parameter.registerEventHandler using the ON_EXCEPTION constant after creating the viewer object, as shown in the following example:

function initParameter( ){
  parameter = new actuate.Parameter("acparameter");
  parameter.registerEventHandler(actuate.parameter.EventConstants.ON_CHANGED, errorHandler);
}

actuate.Parameter.removeEventHandler

Syntax

void Parameter.removeEventHandler(actuate.viewer.EventConstants event, function handler)

Removes an event handler.

Parameters

event

actuate.parameter.EventConstants. A constant corresponding to a supported event. actuate.Parameter supports the following two events:

n  
n  

handler

Function. A handler function registered for the event.

Example

To remove an event handler, call actuate.Parameter.removeEventHandler with a legal event constant, as shown in the following example:

function cleanupParameter( ){
  parameter.removeEventHandler(actuate.parameter.EventConstants.ON_CHANGED, errorHandler);
}

actuate.Parameter.renderContent

Syntax

void Parameter.renderContent(actuate.parameter.ParameterDefinition[ ] paramDefs, function callback)

Renders the parameter component to the container.

Parameters

paramDefs

Array of actuate.parameter.ParameterDefinition objects.

callback

Function. The function to execute after the rendering is done.

Example

This example calls renderContent( ) after hiding parameter groups.

function showNoGroups(myParameter){
  myParameter.hideParameterGroup(zipcodes);
  myParameter.renderContent(myParameterArray, cleanupParameter(myParameter));
}

actuate.Parameter.setAutoSuggestDelay

Syntax

void Parameter.setAutoSuggestDelay(long delay)

Sets the autosuggest delay time.

Parameters

delay

Long. Interpreted as milliseconds.

Example

This example implements a custom autosuggest list. The list is 10 suggestions long and displays 3 suggestions at a time after a delay of 250 milliseconds.

function myCustomAutoSuggest(myParameter){
  myParameter.setAutoSuggestFetchSize(10);
  myParameter.setAutoSuggestListSize(3);
  myParameter.setAutoSuggestDelay(250);
}

actuate.Parameter.setAutoSuggestFetchSize

Syntax

void Parameter.setAutoSuggestFetchSize(integer size)

Set the fetch size of the autosuggestion list. Autosuggest fetches all suggestions from the server when the fetch size is not set.

Parameters

size

Integer. The number of suggestions to fetch at a time.

Example

This example implements a custom autosuggest list. The list is 10 suggestions long and displays 3 suggestions at a time after a delay of 250 milliseconds.

function myCustomAutoSuggest(myParameter){
  myParameter.setAutoSuggestFetchSize(10);
  myParameter.setAutoSuggestListSize(3);
  myParameter.setAutoSuggestDelay(250);
}

actuate.Parameter.setAutoSuggestListSize

Syntax

void Parameter.setAutoSuggestListSize(integer size)

Set the length of the autosuggestion list. Autosuggest shows all of the suggestions from the server when the list length is not set.

Parameters

size

Integer. The number of suggestions to display.

Example

This example implements a custom autosuggest list. The list is 10 suggestions long and displays 3 suggestions at a time after a delay of 250 milliseconds.

function myCustomAutoSuggest(myParameter){
  myParameter.setAutoSuggestFetchSize(10);
  myParameter.setAutoSuggestListSize(3);
  myParameter.setAutoSuggestDelay(250);
}

actuate.Parameter.setContainer

Syntax

void Parameter.setContainer(string containerId)

Sets the HTML element container for the parameter content.

Parameters

containerID

String. The name of the HTML element that displays the group of rendered parameter components.

Example

This example sets the container where the parameter components render.

paramObj.setContainer("leftpane");

actuate.Parameter.setExpandedGroups

Syntax

void Parameter.setExpandedGroups(groupNames)

Defines a set of groups that are expanded by default.

Parameters

groupNames

Array of strings. The group names to expand by default.

Example

This example sets the "Motorcycles," "Trucks," and "Airplanes" groups as expanded by default.

var myGroups = new Array["Motorcycles", "Trucks", "Airplanes"];
paramObj.setExpandedGroups(myGroups);

actuate.Parameter.setFont

Syntax

void Parameter.setFont(string fontStyleString)

Sets the font of the parameter page content after the page is rendered.

Parameters

fontStyleString

String. The name of a font.

Example

This example sets the font to arial for the parameters page.

paramObj.setFont("arial");

actuate.Parameter.setGroupContainer

Syntax

void Parameter.setGroupContainer(string[ ] groupNames, string containerId)

Sets the HTML element container for the provided group. All parameter objects listed in groupNames are assigned to the container.

Parameters

groupNames

Array of strings. The group names to be assigned.

containerID

String. The name of the HTML element that displays the group of rendered parameter components.

Example

This example assigns the group names in the myGroups string array to the leftpane HTML element.

var myGroups = ["Group1", "Group2", "Group3"];
paramObj.setGroupContainer(myGroups, "leftpane");

actuate.Parameter.setLayout

Syntax

void Parameter.setLayout(string layoutName)

Sets the parameter layout.

Parameters

layoutName

String constant. Possible values are:

n  
n  
n  

Example

This example sets the parameter object’s layout type to LAYOUT_COLLAPSIBLE.

paramObj.setLayout("LAYOUT_COLLAPSIBLE");

actuate.Parameter.setReadOnly

Syntax

void Parameter.setReadOnly(boolean readOnly)

Sets the parameters to read-only.

Parameters

readOnly

Boolean. True indicates that the parameters are read-only.

Example

This example makes the parameters read-only.

paramObj.setReadOnly(true);

actuate.Parameter.setReportName

Syntax

void Parameter.setReportName(string reportFile)

Sets the report file from which to get report parameters.

Parameters

reportFile

String. The report file path and name. The report file can be a report design file or a report document file.

Example

To set the name using an HTML input tag with an ID of Selector, use the following code:

myViewer.setReportName(document.getElementById("Selector").value);

actuate.Parameter.setService

Syntax

void Parameter.setService(string iPortalURL, actuate.RequestOptions requestOptions)

Sets the target service URL to which the parameter object links. If the service URL is not set, this parameter object links to the default service URL set on the actuate object.

Parameters

iPortalURL

String. The target Actuate web application URL.

requestOptions

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.

Example

This example sets the URL for the Actuate iPortal web application service.

paramObj.setService("http://localhost:8700/iportal",myRequestOptions);

actuate.Parameter.setShowDisplayType

Syntax

void Parameter.setShowDisplayType(boolean showDisplayType)

Sets whether localized data is shown or not.

Parameters

showDisplayType

Boolean. True indicates that localized data is shown.

Example

This example hides localized data.

paramObj.setShowDisplayType(false);
paramObj.submit(alert("Localized data hidden.");

actuate.Parameter.submit

Syntax

void Parameter.submit(function callback)

Submits requests to the server for the report parameters. When this function is called, an AJAX request is triggered to submit all the operations. When the server finishes the processing, it returns a response and the results are rendered on the page in the parameter container.

Parameters

callback

Function. The function to execute after the asynchronous call processing is done.

Example

This example calls submit( ) after hiding localized data.

paramObj.setShowDisplayType(false);
paramObj.submit(alert("Localized data hidden.");

(c) Copyright Actuate Corporation 2011