Class: HTMLTableWrapperControl

HTMLTableWrapperControl(columnIndex, parent, cellInterpreteropt)

The default ColumnControl used by HTMLTableWrapperListener. Defines a UI where an end-user can select a column's type and sort order, and define filters based upon a custom, user-entered value as well as selection from a list of individual cell values (similar to the column filtering dialogue in MS Excel). Uses a backing ContextControl.

Constructor

new HTMLTableWrapperControl(columnIndex, parent, cellInterpreteropt)

Parameters:
Name Type Attributes Description
columnIndex number

Index of the column this HTMLTableWrapperControl controls.

parent HTMLTableWrapperListener

Parent HTMLTableWrapperListener.

cellInterpreter CellInterpreter | HTMLTableWrapperControl~populateCellValues <optional>

Optional interpreter for cell values to use with calls to HTMLTableWrapperControl#getColumnValues.

Implements:
Source:

Classes

ColumnValueFilter

Members

(static) controlClassName :string

Class name added to ContextControl elements when they are being created by instances of this class.

Type:
  • string
Source:

(static) i18nStrings :object

A 'mapping' object whose property values correspond to labels printed on the dialogue presented to the end-user.

By default, values are in en-US (United States English), however clients that require internationalization can redefine the properties of this object on page initialization (or, at minimum before any HTMLTableWrapperControls are created) for the desired locale. (Alternatively, a completely new object can be assigned, so long as it contains all the property names of the original).

Type:
  • object
Source:

(private, static) idCounter :number

Counter for generating unique DOM ids.

Type:
  • number
Source:

(static, constant) SORT_ORDER_ASCENDING :number

Constant representing a column should have ascending sort order.

Type:
  • number
Source:

(static, constant) SORT_ORDER_DESCENDING :number

Constant representing a column should have descending sort order.

Type:
  • number
Source:

(static, constant) SORT_ORDER_NONE :number

Constant representing a column should have no sort order.

Type:
  • number
Source:

columnIndex :number

Index of the column this ColumnControl handles.

Type:
  • number
Implements:
Source:

(private) contextControl :ContextControl

Backing ContextControl.

Type:
Source:

(private) parent :HTMLTableWrapperListener

Type:
Source:

Methods

(private, static) checkCellInterpreter()

Utility function to check whether the given callback is a function itself (a HTMLTableWrapperControl~populateCellValues), or a CellInterpreter. Throws a TypeError if neither.

Source:
Throws:

TypeError If callback is neither a HTMLTableWrapperControl~populateCellValues nor a CellInterpreter.

(private, static) getIdBase()

Utility function for generating a unique id prefix to use in generated dialogue content.

Source:

(static) hasUnchecked(inputs)

Returns true if any input in the given set of inputs is not checked, otherwise false. Of note, whether each input is of type checkbox, radio, etc. (i.e. an input where the checked attribute is appropriate) is not evaluated; the checked attribute of each input is simply inspected.

Parameters:
Name Type Description
inputs MinimalList

Inputs to inspect.

Source:
Returns:

true if at least one input in inputs has a checked attribute of false, otherwise false.

(static) setChecked(inputs, value)

Sets the first HTMLInputElement's checked attribute in the given set of inputs whose value is the given value. Of note, whether each input is of type checkbox, radio, etc. (i.e. an input where the checked attribute is appropriate) is not evaluated; the checked attribute is simply set.

Parameters:
Name Type Description
inputs MinimalList

Collection of inputs to process.

value string

Value of the input whose checked attribute is to be set.

Source:

close()

Closes this ColumnControl such that it is hidden from the end-user.

Implements:
Source:

(private) defineContent(container)

Defines the UI content on the given container, and registers this HTMLTableWrapperControl for the appropriate events on generated elements. Only intended to be called once (in response to ContextControl#event:create events).

Parameters:
Name Type Description
container HTMLElement

Element upon which the content of this control is to be defined.

Source:

dispose()

Optional function to dispose this object. The object should not be relied upon to be usable after calling this function, however whether it actually is, or not, is entirely implementation-dependent.

Inherited From:
Implements:
Source:

(private) getCheckedValue(selector) → {string}

Utility function to obtain the value of the first checked input element within this control's backing HTMLElement matching the given query selector. The querySelectorAll function is ran on the backing element, and the result is iterated until the first element with a checked attribute of true is encountered, in which case that element's value attribute is returned. If no checked element is found with the given selector, or this control has not yet been opened, null is returned.

Parameters:
Name Type Description
selector string

Query selector string.

Source:
Returns:

The value of the first checked element within this control matching the given selector, or null if no checked element is found, or this control has not yet been opened.

Type
string

getColumnType() → {number}

Returns the HTMLTableWrapperUtils.COLUMN_TYPE_* constant corresponding to the current selected column type, or null if no column type is selected, or this control has not yet been opened.

Source:
Returns:

The HTMLTableWrapperUtils.COLUMN_TYPE_* constant corresponding to the current selected column type, or null if no column type is selected, or this control has not yet been opened.

Type
number

getColumnValues(noSortopt) → {Array}

Returns and Array containting all the individual cell values of the column with which this HTMLTableWrapperControl is associated. If this HTMLTableWrapperControl has a CellInterpreter or HTMLTableWrapperControl~populateCellValues callback configured, it will be used to obtain the values of individual cells, otherwise, returns the unique set of each cell's trimmed textContent. If any call to a defined interpreter returns true, the cell's trimmed textContent is also used.

By default, the result is sorted prior to being returned, unless the noSort parameter is not Nothing.

Parameters:
Name Type Attributes Default Description
noSort boolean <optional>
false

Whether to return the result unsorted.

Source:
Returns:

All the values within the column this HTMLTableWrapperControl controls.

Type
Array

getFilterDescriptor() → {FilterDescriptor}

Called by HTMLTableWrapperListener#processTable to obtain a FilterDescriptor based upon the current state of this ColumnControl. If this control is in a state in which no filtering should be performed, it is permissible to return Nothing.

Implements:
Source:
Returns:

A FilterDescriptor based upon the state of this ColumnControl or Nothing if no filtering should be performed.

Type
FilterDescriptor

getOperator() → {number}

Returns a combination of the HTMLTableWrapperUtils.FILTER_OP_* and FILTER_FLAG_* bitfields corresponding to the current selected operator, or null if no operator is selected, or this control has yet not been opened.

Source:
Returns:

A combination of the HTMLTableWrapperUtils bitfields corresponding to the current selected operator, or null if no operator is selected, or this control has not yet been opened.

Type
number

getOperatorDescription() → {string}

Returns a description based upon the current selected operator, or null if no operator is selected, or this control has not yet been opened.

Source:
Returns:

A description based upon the current selected operator, or null if no operator is selected, or this control has not yet been opened.

Type
string

getSortDescriptor() → {SortDescriptor}

Called by HTMLTableWrapperListener#processTable to obtain a SortDescriptor based upon the current state of this ColumnControl. If this control is in a state in which no sorting should be performed, it is permissible to return Nothing.

Implements:
Source:
Returns:

A SortDescriptor based upon the state of this ColumnControl or Nothing if no sorting should be performed.

Type
SortDescriptor

getSortOrder() → {number}

Returns the SORT_ORDER_* constant defined on this class corresponding to the current selected sort order, or null if no sort order is selected, or this control has not yet been opened.

Source:
Returns:

The SORT_ORDER_* constant defined on this class corresponding to the current selected sort order, or null if no sort order is selected, or this control has not yet been opened.

Type
number

handleEvent(event)

Implementation of DOM EventListener.

Parameters:
Name Type Description
event Event

Event being dispatched.

Source:

init()

Optional function to initialize this object for use. The object should be usable after calling this function.

Inherited From:
Implements:
Source:

open()

Opens this ColumnControl such that it is visible to the end-user.

Implements:
Source:

reset()

Resets the state of this HTMLTableWrapperControl; all fields will be reset to their inital values. Note, this only updates the state of the user interface; if the parent table needs to be updated, HTMLTableWrapperControl#updateParent must be called subsequently.

Source:

selectAllColumnValues(checked)

Selects or deselects all individual cell values for filtering. Note, this only updates the state of the cell value checkboxes; if the parent table needs to be updated HTMLTableWrapperControl#updateParent must be called subsequently.

Parameters:
Name Type Description
checked boolean

Whether to select or deselect all individual cell values.

Source:

updateParent()

Updates the parent table.

Source:

Type Definitions

populateCellValues(cell, values)

Optional callback for HTMLTableWrapperControl to customize how cell values are interpreted. Based upon the given cell, should determine the individual cell value/values, and add them to the given ColumnValueSet. If true is returned from a call to this function, default processing, as defined in HTMLTableWrapperControl#getColumnValues will be triggered.

Parameters:
Name Type Description
cell HTMLTableCellElement

Cell element whose values are to be retrieved.

values ColumnValueSet

Values to populate.

Source:
Returns:

true to trigger default column value processing, otherwise Nothing.