Module: nmodule/webEditors/rc/wb/table/Table


new (require("nmodule/webEditors/rc/wb/table/Table"))(params)

API Status: Development

Table widget.

It supports the following bajaux Properties:

  • fixedHeaders: (boolean) set to true to allow scrolling the table body
    up and down while the headers remain fixed. This will only make sense
    when the table widget is instantiated in a block-level element, like a
    div, whose dimensions are constrained.
  • hideUnseenColumns: (boolean) set to false to cause columns with the
    UNSEEN flag to always be shown. Defaults to true (unseen columns are
    hidden by default).
  • density: (string) supports "small", "medium" and "large" font-sizes to
    specify the density of the table
Extends:
Parameters:
Name Type Description
params Object
Properties
Name Type Argument Description
selection module:nmodule/webEditors/rc/util/ListSelection <optional>

the ListSelection
to manage which rows are currently selected - if not given, a new one will be constructed.

Implements:
  • module:nmodule/export/rc/TransformOperationProvider

Methods


$handleColumnEvent(tableModel, columns, eventName)

Parameters:
Name Type Description
tableModel module:nmodule/webEditors/rc/wb/table/model/TableModel
columns Array.<module:nmodule/webEditors/rc/wb/table/model/Column>
eventName string
Returns:
Type
Promise

$handleRowEvent(tableModel, rows, eventName, args)

Parameters:
Name Type Description
tableModel module:nmodule/webEditors/rc/wb/table/model/TableModel
rows Array.<module:nmodule/webEditors/rc/wb/table/model/Row>
eventName string
args Array.<*>
Returns:
Type
Promise

$initializePagination(model)

Arm event handlers on the loaded PaginationModel.

Parameters:
Name Type Description
model module:nmodule/webEditors/rc/wb/table/pagination/PaginationModel
Returns:
Type
Promise

destroy()

Removes the editor class and emits a destroyed tinyevent.

Inherited From:
Returns:

call to module:bajaux/Widget#destroy

Type
Promise

doChanged()

Detect density property change and apply it to the table

See:
  • module:nmodule/webEditors/rc/wb/table/Table for valid densities

doDestroy()

Remove TableWidget class and event handlers from the loaded table model.


doInitialize(dom, params)

Initialize the HTML table, creating thead, tbody, and tfoot elements.

Parameters:
Name Type Description
dom JQuery
params Object

optional initialization parameters


doLoad(model)

Load in a TableModel, immediately rendering all columns and rows. Event
handlers will be registered to listen for updates to the table model.

Parameters:
Name Type Description
model module:nmodule/webEditors/rc/wb/table/model/TableModel
Throws:

if no TableModel provided

Type
Error
Returns:
Type
Promise

getModel()

Get the currently loaded TableModel.

Since:
  • Niagara 4.6
Returns:
Type
module:nmodule/webEditors/rc/wb/table/model/TableModel

getSelectedRows()

Get all rows which are currently selected by the user.

Since:
  • Niagara 4.6
Returns:
Type
Array.<module:nmodule/webEditors/rc/wb/table/model/Row>

getSubject(elem)

When showing a context menu, will decide which values in the TableModel are
the targets of the right-click operation.

If the row being right-clicked is not already selected, then the subject of
the corresponding Row will be used to show the context menu.

If the row being right-clicked is already selected, then the subjects of
all selected Rows will be used.

Parameters:
Name Type Description
elem JQuery
Returns:

array containing the subjects of the rows being
right-clicked. Can return an empty array if no rows are present.

Type
Array.<*>

getTransformOperations()

Returns:
Type
Promise.<Array.<module:nmodule/export/rc/TransformOperation>>

initialize(dom)

Every BaseWidget will add the editor class to the element and emit an
initialized tinyevent when initialized.

Parameters:
Name Type Description
dom JQuery
Inherited From:
Returns:

call to module:bajaux/Widget#initialize

Type
Promise

shouldValidate( [flag])

This provides an extra hook for an editor to declare itself as needing to
be validated before saving or not. The default behavior is to return true
if this editor is modified, or if a shouldValidate bajaux Property
is present and truthy. If neither of these conditions is true, it will
check all known child editors, and return true if it has a child editor
that should validate.

If flag is given, then the check against the shouldValidate
Property will return true only if the value bitwise matches the
parameter. See BaseWidget.SHOULD_VALIDATE_ON_SAVE, etc.

Parameters:
Name Type Argument Description
flag Number <optional>
Inherited From:
Returns:
Type
Boolean

sort(column, desc)

Sort table rows given a column and asc/desc flag.

Override this if you want to override the sort ordering.

Parameters:
Name Type Description
column module:nmodule/webEditors/rc/wb/table/model/Column
desc boolean
Since:
  • Niagara 4.8
Returns:
Type
Promise | *