Class: Table

Table

The Table control allows you to create a table using other controls such as Text, Decimal, Output Text, etc. A Table control provides the following configuration properties in Process Designer:

Behavior

Selection Mode: The selection mode
{None | Single | Multiple}
string
Show Delete Button: Visibility of the delete button. DESIGN TIME ONLY. boolean
Show Footer: Visibility of the footer boolean
Show Add Button: Visibility of the add row button. DESIGN TIME ONLY. NOTE: If the table is sorting or filtering, the newly added row may not be displayed as the last row in the table - or may not be displayed at all until sorting/filtering is cleared! boolean
Show Table Stats: Enable to show table stats in footer (e.g., "Showing 1 to 5 of 59 entries") boolean
Show Pager: Visibility of the pager boolean
Show Page Sizer: The page sizer allows the user to choose the number of rows viewable at a given time boolean
Initial Page Size: Page size in integer (rows) integer

Columns: Specifications of the columns (Render As, Visibility, Sortable, Options, CSS, Width, Label). NOTE: DESIGN TIME ONLY TableColumn[]
Render as How cell contents should be rendered
{Coach View | Seamless Coach View | Simple HTML | Custom}
string
Visibility Column visibility
{Visible | Read-Only | None}
string
Sortable When enabled, table can be sorted using this column boolean
Options Optional data to pass to cell, depending on type of data in column. Includes:  - Decimal: thousandsSeparator, decimalPlaces, decimalSeparator, postfix, prefix  - DatePicker: datePattern  - Link: href  - Integer: thousandSeparator string
Css CSS styling to apply to column (e.g. color:#00ff00) string
Width Column width string
Label Set the Column Label string

Appearance

Table Style: Set the table style
{Default | Elegant | Bordered | Striped | Hover Row | Condensed}
string
Color Style: Color style of the table
{None | Light | Primary | Info | Success | Warning | Danger}
string
Highlight Selection: Shade rows in a selected state. Requires that a Color Style other than None be specified. boolean
Width: Width in px, %, em For example: 50px, 20%, 0.4em. If no unit is specified, px is assumed string
Height: Height of table in px, %, em (not including the header or footer if shown) For example: 50px, 20%, 0.4em. If no unit is specified, px is assumed string

Performance

Async Loading: Provides a better UI experience for large data sets (at the expense of slower overall row-loading time once the section starts loading). boolean
Async Batch Size: Defines how many rows are loaded synchronously in an asynchronous batch. This can help tune/optimize synchronous vs. asynchronous loading performance. integer

Events

On Load:
Description: Controls: Table, Service Data Table. This event is triggered when the table is loaded.
Example:
																	me.setPageIndex(0);																
On Custom Cell:
Description: Controls: Table, Service Data Table. This event fires whenever a cell loads with custom rendering options. In order to make use of this event, you must set the Render as configuration value to Custom in Columns.
Example:
																	var div = document.createElement("div"); div.innerHTML =									cell.row.data[cell.varName]; return div;																
Context Variables cell {object}
Properties colIndex
controlType
parentNode
row {data, index}
varName
On Rows Loaded:
Description: Controls: Table, Service Data Table. This event is applicable only for paged tables, it fires when rows are displayed.
Example:
																	alert("All rows have " + (all ? "" : "NOT") + " been loaded");																
Context Variables all {boolean}
On Row Selected by User:
Description: Controls: Table, Service Data Table. This event fires whenever a row is selected by the user
Example:
																	alert("Selected row has index " + row.index);																
Context Variables row {object}
Properties index
data (object containing the table row data properties)
On Deleting Record:
Description: Controls: Table, Service Data Table. This event is fired when the asks to delete a record. If the event returns false the record will not be deleted
Example:
																	return confirm("Are you sure you want to delete item " +									item.str1);																
Context Variables item {object}
Properties table row data properties
On Service Data Loaded:
Description: Controls: Service Data Table only. This event is triggered when AJAX service supplying the table data completes successfully.
Example:
																	alert("AJAX service has returned with data");																
On Service Data Error:
Description: Controls: Service Data Table only. This event is triggered when AJAX service supplying the table data completes sunuccessfully.
Example:
																	alert("AJAX service has returned with an error");																
Article(s) Table

new Table()

This constructor is never used explicitly.

Extends

Members

Methods

Add/replace CSS class(es) for this control
Name Type Description
name string CSS class name(s) to add to the control. Separate class names by a space if more than one class.
replaced string optional CSS class name(s) to be replaced by the first argument. Separate class names by a space if more than one class.
Example
Button.addClass("green");

appendElement(obj)

Adds the specified element to the table -- appendRecord() and add() are aliases to this method.
Name Type Description
obj object The element to be added
Examples
${Table}.appendElement({});  //to create a new empty row
${Table}.appendElement({"str1":"strVal", "int1": 3});  //new row with data

appendElements(objs)

Adds the specified elements/records to the table -- appendRecords() and addAll() are aliases to this method. Because adding an element causes the table to re-render, use this method for better performance while adding multiple records instead of repeatedly calling appendElement()
Name Type Description
objs Array.<object> The element/record to be added
Example
${Table}.appendElements([{"str1":"strVal", "int1": 3}, {"str1":"strVal2", "int1": 4}]);  //new row with data

clear()

Clear the records from this table (leaves it empty but the column headers remain)

clearSearch()

Clears the search filter and reloads the table

clearSort(){boolean}

Clears the sort and redisplays the table
Returns:
Type Description
boolean

getColorStyle(){string}

Gets color style of table. NOTE: This always returns the color as set, to avoid ambiguity always set the color using "D"|"L"|"P"|"I"|"S"|"W"|"G"
Returns:
Type Description
string

getColumns(){object}

Gets column specifications for the Service Data Table
Returns:
Type Description
object columnSpecs The specifications for the columns (are not to be modified)

getFilteredRecords(col, exp, caseInsensitive, useRegex){Array.<Object>}

Returns the records matching the search parameters. This methods does not modify the table and is not affected by a table's existing filtering or sorting
Name Type Description
col any When the type is "number" this is the column to be searched or null for all columns. When type is "string" this is the property name in the table to be searched. When the type is "function" this is the comparator function to use for the search. Note that when the type is function, the other parameters are ignored.
exp string regular expression or string to use for the search depending on useRegex
caseInsensitive boolean whether the search should be case insensitive
useRegex boolean optional whether or not to use the regular expression set
Returns:
Type Description
Array.<Object>

getHighlightSelection(){boolean}

This returns whether a row is highlighted when selected. Not in Service Data Tables
Returns:
Type Description
boolean

getMaxPageIndex(){integer}

Get the maximum page index
Returns:
Type Description
integer

getPageIndex(){integer}

Returns the page index
Returns:
Type Description
integer

getPageSize(index, actual){integer}

Returns the page size
Name Type Description
index integer (Optional) Index of page - if null, uses the current page
actual boolean If true, gets the actual page size (i.e. number of rows on the page) instead of the configured page size
Returns:
Type Description
integer

getRecord(index, asInTable){Object}

Returns the record at the specific index
Name Type Description
index integer 0-based index/position of record
asInTable boolean If true, returns record as sorted and/or filtered in the table, if false or omitted returns the record unfiltered and according to the original order. Record indices with "asInTable" take sorting and filtering into account but are independent of whether the table is paging or not.
Returns:
Type Description
Object

getRecordCount(asInTable){integer}

Returns the number of records in the table
Name Type Description
asInTable boolean If true, returns count of records filtered by search, if false or omitted returns the unfiltered record count. Record counts ith "asInTable" take sorting and filtering into account but are independent of whether the table is paging or not.
Returns:
Type Description
integer

getRecordIndex(record, asInTable){integer}

Returns the record at the specific index
Name Type Description
record Object
asInTable boolean If true, returns the index of the record as sorted and/or filtered in the table, if false or omitted returns the index of the record unfiltered and according to the original order. Record indices with "asInTable" take sorting and filtering into account but are independent of whether the table is paging or not.
Returns:
Type Description
integer

getRecordOnPage(recIdx, pageIdx){Object}

Returns the record at the index and page specified - respecting the sorting and filtering that may be active on the table.
Name Type Description
recIdx integer
pageIdx integer (Optional) If not specified, assumes current page
Returns:
Type Description
Object Or undefined if the page index and record index don't match an actual record in the table

getRecords(asInTable){Array.<Object>}

Returns the record at the specific index
Name Type Description
asInTable boolean If true, returns records as sorted and/or filtered in the table, if false or omitted returns the records unfiltered and according to the original order. Record indices with "asInTable" take sorting and filtering into account but are independent of whether the table is paging or not.
Returns:
Type Description
Array.<Object>

getRecordsOnPage(pageIdx){Array.<Object>}

Returns the records at page index specified - respecting the sorting and filtering that may be active on the table.
Name Type Description
pageIdx integer (Optional) If not specified, assumes current page
Returns:
Type Description
Array.<Object>

getRowForView(v){Row}

getRow is an alias for this method. Gets the row containing the specified child view. The row object can be used to retrieve data associated with the row [using .getData()], or any view instance on the row [using .getView()].
Name Type Description
v object A view instance in the table (in one of the table cells)
Returns:
Type Description
Row The row object containing the view

getSelectedIndex(asInTable){integer}

Returns the selected record (if any)
Name Type Description
asInTable boolean If true, returns the index of the selected record based on the current filtering and sort order of the table. If false or omitted returns the index of the selected record regardless of table filtering and based on the natural/original order of the records. Record indices with "asInTable" take sorting and filtering into account but are independent of whether the table is paging or not.
Returns:
Type Description
integer

getSelectedIndices(asInTable){Array.<integer>}

Returns the selected records (if any) - Note that the indices array may not always be sorted in ascending order of indices
Name Type Description
asInTable boolean If true, returns the indices of the selected records based on the current filtering and sort order of the table. If false or omitted returns the index of the selected records regardless of table filtering and based on the natural/original order of the records. Record indices with "asInTable" take sorting and filtering into account but are independent of whether the table is paging or not.
Returns:
Type Description
Array.<integer>

getSelectedRecord(asInTable){Object}

Returns the selected record (if any)
Name Type Description
asInTable boolean If true, returns the selected record (if any) from the records not filtered out in the table. If false or omitted returns the selected record (if any) regardless of table filtering. Records returned with "asInTable" take sorting and filtering into account but are independent of whether the table is paging or not.
Returns:
Type Description
Object

getSelectedRecordCount(asInTable){integer}

Returns the selected record (if any)
Name Type Description
asInTable boolean If true, returns the count of selected records from the records not filtered out in the table. If false or omitted returns the count of selected record regardless of table filtering. Record counts with "asInTable" take sorting and filtering into account but are independent of whether the table is paging or not.
Returns:
Type Description
integer

getSelectedRecords(asInTable){Array.<Object>}

Returns the selected record (if any)
Name Type Description
asInTable boolean If true, returns the selected records (if any) from the set of records not filtered out in the table. If false or omitted returns the selected records (if any) regardless of table filtering. Records returned with "asInTable" take sorting and filtering into account but are independent of whether the table is paging or not.
Returns:
Type Description
Array.<Object>

getTableStyle(){string}

Gets the table style. NOTE: This always returns the table style as set.
Returns:
Type Description
string

getTitle(){string}

Gets the table title/label
Returns:
Type Description
string

getType(){string}

Get descriptive string representing the type of control
Returns:
Type Description
string

getWidth(){string}

Get configured width for section (including unit)
Returns:
Type Description
string
Hide this view/control
Name Type Description
collapseFlag boolean Set to true to collapse the view (equivalent to a view setting of "NONE")
Example
MyView.hide();
Indicates bound status of control.
Returns:
Type Description
boolean . True if the control is bound to coach data.
Checks if the view is enabled or not
Returns:
Type Description
boolean Enabled status
Example
var enabled = MyView.isEnabled();
Checks if control label is visible
Returns:
Type Description
boolean Label visibility status
Example
var labelVisible = MyView.isLabelVisible();

isRecordSelected(record, asInTable){boolean}

Returns whether a particular record is selected
Name Type Description
record integer | object the index of the record to be removed, or the record object itself
asInTable boolean (Only used with index) If true, checks the selected status of the record at the sorted and/or filtered index position, if false or omitted checks the selected status of the record at the index according to the original order and regardless of filtering.
Returns:
Type Description
boolean
Checks whether or not view is visible
Returns:
Type Description
boolean Visibility status
Example
var visible = MyView.isVisible();
Propagates value change of control up through parent views
Name Type Description
event Event Value change event (usually an onchange event)
Returns:
Type Description
boolean True if a formula update was triggered on the control's parent, otherwise false
Example
MyView.propagateUp(event);

removeRecord(record, asInTable){boolean}

Remove the specified table record. Not in Service Data Table
Name Type Description
record integer | object the index of the record to be removed, or the record object itself
asInTable boolean (Only used with index) If true, removes the record at the sorted and/or filtered index position, if false or omitted removes the record at the index according to the original order. Record indices with "asInTable" take sorting and filtering into account but are independent of whether the table is paging or not.
Returns:
Type Description
boolean true if record successfully removed
Retrieves record according to the specified parameters -- alias to filter() method
Name Type Description
col any When the type is "number" this is the column to be searched or null for all columns. When type is "string" this is the property name in the table to be searched. When the type is "function" this is the comparator function to use for the search. Note that when the type is function, the other parameters are ignored.
exp string regular expression or string to use for the search depending on useRegex
caseInsensitive boolean whether the search should be case insensitive
useRegex boolean optional whether or not to use the regular expression set
Example
me.search(0, "[0-9]", true, true)

setAllRecordsSelected(selected, asInTable)

Selects or unselects records
Name Type Description
selected boolean Flag to indicate whether to select or unselect the records
asInTable boolean (Only used with index) If true, sets the selected status of the records that are not filtered out, if false or omitted sets the selected status of all records regardless of filtering

setColorStyle(style)

Sets color style of table. NOTE: to avoid ambiguity always set the color using "D"|"L"|P"|"I"|"S"|"W"|"G"
Name Type Description
style string "DEFAULT"|"DEF"|"D"=Default | "LIGHT"|"L"=Light | PRIMARY"|"P"=Primary | "INFO"|INF"|"I"=Info | "SUCCESS"|"S"=Success | "WARNING"|"WARN"|"W"=Warning | "ERROR"|"ERR"|"DANGER"|"G"=Danger
Enable/disable this view/control
Name Type Description
enabled boolean Enabled/read-only flag (true to enable view, false to disable/make read-only)
required boolean Enable/disable required field flag for control
Example
MyView.setEnabled(false); //Make MyView read-only

setHighlightSelection(highlight)

This sets whether a row is highlighted when selected. Not in Service Data Tables
Name Type Description
highlight boolean Set to true to enable selection highlights
Show/hide the label of this view/control
Name Type Description
visible boolean Label visibility flag (true to show view label, false to hide)
Example
MyView.setLabelVisible(false);

setPageIndex(idx)

Set the page index, 0-based indexing
Name Type Description
idx integer the page index

setPageSize(size)

Set the page size, number of rows in a given page
Name Type Description
size integer the page size

setRecordSelected(record, selected, asInTable)

Returns whether a particular record is selected
Name Type Description
record integer | object the index of the record to be removed, or the record object itself
selected boolean Flag to indicate whether to select or unselect the record
asInTable boolean (Only used with index) If true, sets the selected status of the record at the sorted and/or filtered index position, if false or omitted sets the selected status of the record at the index according to the original order and regardless of filtering

setTableStyle(style)

This programmatically sets the table style. NOTE: No error checking.
Name Type Description
style string "D"=Default | "E"=Elegant | "B"=table-bordered | "S"=table-striped | "H"=table-hover | "C"=table-condensed

setTitle(title)

Programmatically sets the table title/label in the table's header
Name Type Description
title string
Show/hide this view/control
Name Type Description
visible boolean Visibility flag (true to show view, false to hide)
collapse boolean Set to true to collapse the control space when visible is set to false.
Examples
MyView.setVisible(false, false); //Equivalent to MyView.hide()
MyView.setVisible(false, true); // Sets visibility to "None"

setWidth(width)

Set width of table (e.g. 50px, 20%, 2em - omitting the unit assumes px)
Name Type Description
width string sets the width
Show this view/control
Example
MyView.show();

sort(col, asc, use)

Sort by column and whether it should be in ascending order
Name Type Description
col string the column name
asc boolean optional ascending order, default is false
use boolean sort value that was specified at cell render time using cell.setSortValue() instead of simply using the displayed text
Broadcasts the expression trigger for the specified view
Name Type Default Description
phase int bpmext.ui.PHASE_NORMAL optional The phase we are currently in
Example
MyView.triggerFormulaUpdates();