Class actuate.viewer.SelectedContent
Description
A container for content selected in the viewer. SelectedContent provides an object to pass to a handler when the user-defined ON_CONTENT_SELECTED event occurs. This object contains an instance of the element selected in the viewer.
Constructor
The SelectedContent object is constructed when an ON_CONTENT_SELECTED event occurs.
Function summary
Table 7‑58 lists actuate.viewer.SelectedContent functions.
Table 7‑58 actuate.viewer.SelectedContent functions
Function
Description
Returns the bookmark value for the currently selected element
Returns the native browser event click
Returns the currently selected table column index number
Returns the index location of the currently selected table row
Returns a copy of the currently selected element
getBookmark
Syntax
String SelectedContent.getBookmark( )
Returns the string value of the bookmark for the currently selected column.
Returns
String.
Example
To retrieve the bookmark of a selected column, use the following code:
//Register an event handler function mySelectionCB
viewer.registerEventHandler( actuate.viewer.impl.EventConstants
.ON_CONTENT_SELECTED, mySelectionCB );
 
// implement the registered event handler function mySelectionCB
function mySelectionCB( viewerInstance, selectedItem ) {
var bookmark = selectedItem.getBookmark( );
}
getBrowserEventObject
Syntax
Event SelectedContent.getBrowserEventObject( )
Returns the native browser event occurring on click. You can inspect what the type of the click event is.
Returns
Integer.
Example
To retrieve the index of a selected table row, use the following code:
//Register an event handler function mySelectionCB
fviewer.registerEventHandler( actuate.viewer.impl.EventConstants.ON_CONTENT_SELECTED, mySelectionCB );
 
// implement the registered event handler function mySelectionCB
function mySelectionCB( viewerInstance, selectedItem ) {
var event = selectedItem.getBrowserEventObject( );
if ( isRightClick( event ) ) {
// show custom menu
}
else {
// highlight cell selection
}
}
getRowIndex
Syntax
Integer SelectedContent.getRowIndex( )
Returns the Integer value of the currently selected table row.
Returns
Integer.
Example
To retrieve the index of a selected table row, use the following code:
//Register an event handler function mySelectionCB
viewer.registerEventHandler( actuate.viewer.impl.EventConstants.ON_CONTENT_SELECTED, mySelectionCB );
 
// implement the registered event handler function mySelectionCB
function mySelectionCB( viewerInstance, selectedItem ) {
var rowIdx = selectedItem.getRowIndex( );
}
getColumnIndex
Syntax
integer SelectedContent.getColumnIndex( )
Returns the numerical index for the currently selected column. Returns null when the user selects a non-table element.
Returns
Integer.
Example
To retrieve the index of a selected column, use the following code:
var index = selected.getColumnIndex( );
getSelectedElement
Syntax
object SelectedContent.getSelectedElement( )
Returns an instance of the currently selected element. The instance can be one of the following objects:
*actuate.report.Chart
*actuate.report.DataItem
*actuate.report.Label
*actuate.report.Table
*actuate.report.TextItem
To determine the object type, use the Object.getType( ) function. The type strings for the above objects are Chart, Data, Label, Table, or Text, respectively.
Returns
Object. An instance of the currently selected element.
Example
To retrieve and store a label bookmark if a selected element is a label, use the following code:
var selected = selected.getColumnIndex( );
if (selected.getType( ) == "Label"){
var bmark = Object.getBookmark( );
}