Class actuate.report.Table
Description
A container for a Table element in a report. Table provides functions to operate on a Table element, such as manipulating columns, groups, and data.
Constructor
The Table object is constructed by viewer.PageContent.getTableByBookmark( ).
Function summary
Table 4-36 lists actuate.report.Table functions.
Gets the Table data by column index and returns only the data from the current visible page
Submits all the asynchronous operations that the user has requested on this report and renders the Table component on the page
actuate.report.Table.clearFilters
Syntax
void Table.clearFilters(string columnName)
Clears the filters of a given column.
Parameters
columnName
String. The name of the column.
Example
This example clears existing filters from the PRODUCTLINE column:
function resetFilter(myTable){
  myTable.clearFilters("PRODUCTLINE");
  myTable.submit( );
}
actuate.report.Table.getBookmark
Syntax
string Table.getBookmark( )
Returns the Table’s name.
Returns
String. The name of the Table.
Example
This example displays the Table’s bookmark in an alert box:
function alertBookmark(myTable){
  alert(myTable.getBookmark( ));
}
actuate.report.Table.getColumn
Syntax
array[ ] Table.getColumn(integer columnIndex)
Gets the Table data by column index. Returns the data from the current visible page.
Parameters
columnIndex
Integer. Optional. The numerical index of the column from which to retrieve data. The getColumn( ) function returns the values for the first column when no value is provided for columnIndex.
Returns
Array. A list of data in the format of the column.
Example
This example returns the first column in myTable:
function getMyColumn(myTable) {
  return myTable.getColumn( );
}
actuate.report.Table.getHtmlDom
Syntax
HTMLElement Table.getHtmlDom( )
Returns the Table’s name.
Returns
String. The name of the Table.
Example
This example displays the HTML DOM element for this Table inside a red border:
function showHtmlDom(myTable){
  var domNode = myTable.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);
}
actuate.report.Table.getInstanceId
Syntax
string Table.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(myTable){
  var elementID = myTable.getInstanceId( );
  alert (elementID);
}
actuate.report.Table.getPageContent
Syntax
actuate.viewer.PageContent Table.getPageContent( )
Returns the page content to which this Table belongs.
Returns
actuate.viewer.PageContent. report content.
Example
This example displays the viewer ID of the page content in an alert box:
function showViewID(myTable){
  var pageContent = myTable.getPageContent( );
  var pageViewerID = pageContent.getViewerId( );
  alert (pageViewerID);
}
actuate.report.Table.getRow
Syntax
array[ ] Table.getRow(integer rowIndex)
Gets the Table data by row index. Returns the data from the current visible page.
Parameters
rowIndex
Integer. Optional. The numerical index of the row from which to retrieve data. The getRow( ) function returns the values for the first row when no value for rowIndex is provided.
Returns
Array. A list of data in the format of the columns that cross the row.
Example
This example retrieves the first row in myTable:
function getMyRow(myTable) {
  return myTable.getRow( );
}
actuate.report.Table.getType
Syntax
string Table.getType( )
Returns the report element type of this object, which is Table.
Returns
String. "Table".
Example
This example returns the report element type of this object in an alert box:
function getTableType(myTable) {
  alert("Element type is: " + myTable.getType( ));
}
actuate.report.Table.groupBy
Syntax
void Table.groupBy(string columnName)
Groups the data in a table by the values in a given column. If there is an existing group, this operation will add the new group after the existing group.
Parameters
columnName
String. The name of the column to use for the inner-most group to the Table.
Example
This example groups the data in myTable by the values in the TOTAL column:
function groupByColumn(myTable) {
  myTable.groupBy("TOTAL");
}
actuate.report.Table.hide
Syntax
void Table.hide( )
Hides this element.
Example
This example hides myTable:
myTable.hide( );
actuate.report.Table.hideColumn
Syntax
void Table.hideColumn(string columnName)
Hides a table column by specifying the column name.
Parameters
columnName
String. The data binding name for the column to hide.
Example
This example hides the TOTAL column from myTable:
function myHiddenColumn(myTable) {
  myTable.hideColumn("TOTAL");
  myTable.submit( );
}
actuate.report.Table.hideDetail
Syntax
void Table.hideDetail(string columnName)
Hides information for a column from the grouped data displayed on the page. If every column is hidden, only the group name is visible.
Parameters
columnName
String. The data binding name for the column to hide.
Example
This example hides the TOTAL column from the grouped data visible for myTable:
function hideMyDetail(myTable) {
  myTable.hideDetail("TOTAL");
  myTable.submit( );
}
actuate.report.Table.removeGroup
Syntax
void Table.removeGroup()
Removes the inner-most group.
Example
This example removes the inner-most group from myTable and displays an alert box after calling submit( ):
function removeMyGroup(myTable) {
  myTable.removeGroup();
  myTable.submit(alert("Group removed"));
}
actuate.report.Table.setFilters
Syntax
void Table.setFilters(actuate.data.Filter filter)
void Table.setFilters(actuate.data.Filter[ ] filters)
Applies a filter or filters to this Table element.
Parameters
filter
actuate.data.Filter object. A single filter condition to apply to this Table.
filters
An array of actuate.data.Filter objects. Filter conditions to apply to this Table.
Example
To add a filter to the Table to display only entries with a CITY value of NYC, use the following code:
var filters = new Array( );
var city_filter = new actuate.data.Filter("CITY", actuate.data.Filter.EQ, "NYC");
filters.push(city_filter);
table.setFilters(filters);
actuate.report.Table.setSorters
Syntax
void Table.setSorters(actuate.data.Sorter sorter)
void Table.setSorters(actuate.data.Sorter[ ] sorters)
Applies a sorter or sorters to this Table.
Parameters
sorter
actuate.data.Sorter object. A single sort condition to apply to this Table.
sorters
An array of actuate.data.Sorter objects. Sort conditions to apply to this Table.
Example
This example adds the myStateSorter and myCitySorter sorters to myTable:
function setAllMySorters(myTable) {
  myTable.setSorters(["myStateSorter", "myCitySorter"]);
}
actuate.report.Table.show
Syntax
void Table.show( )
Shows this element.
Example
Use show( ) to reveal a report Table, as shown in the following code:
myTable.show( );
actuate.report.Table.showColumn
Syntax
void Table.showColumn(string columnName)
Shows the Table column by specifying the column name.
Parameters
enabled
String. The data binding name for the column to display.
Example
This example shows the PRODUCTLINE column in myTable:
function showMyColumn(myTable) {
  myTable.showColumn("PRODUCTLINE");
  myTable.submit( );
}
actuate.report.Table.showDetail
Syntax
void Table.showDetail(string columnName)
Displays information for a column from the grouped data displayed on the page. If every column is hidden, only the group name is visible.
Parameters
columnName
String. The data binding name for the column to display.
Example
This example shows the information from the PRODUCTLINE column in the grouped data that is displayed for myTable:
function showMyDetail(myTable) {
  myTable.showDetail("PRODUCTLINE");
  myTable.submit( );
}
actuate.report.Table.submit
Syntax
void Table.submit(function callback)
Submits all the asynchronous operations for this Table element. The submit( ) function triggers an AJAX request to submit all the asynchronous operations. When the server finishes the processing, it returns a response and the results are rendered on the page in the table container.
Parameters
callback
Function. The function called after the asynchronous call processing finishes.
Example
This example clears existing filters from the PRODUCTLINE column and pops up an alert box:
function alertResetFilter(myTable){
  myTable.clearFilters("PRODUCTLINE");
  myTable.submit(alert("Filters Cleared"));
}
actuate.report.Table.swapColumns
Syntax
void Table.swapColumns(string columnName1, string columnName2)
Swaps the columns to reorder to column sequence of the Table.
Parameters
columnName1
String. The first column to swap in the column order.
columnName2
String. The second column to swap in the column order.
Example
This example swaps the TOTAL and PRODUCTLINE columns in myTable:
function swapMyColumns(myTable){
  myTable.swapColumns("TOTAL", "PRODUCTLINE");
  myTable.submit( );
}

Additional Links:

Copyright Actuate Corporation 2012