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

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

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

Description:
  • 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.
    • leftJustify: (boolean) set to true to left-justify the table and span
      the last visible column of the table to 100% width.This makes the table
      itself 100% width now, so the table will no longer work inline. Defaults
      to true.
    • 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
    • enableStriping: (boolean) defaults to true and shows stripes on table widget,
      and is ignored if on a
Source:
Implements:
  • module:nmodule/export/rc/TransformOperationProvider
Extends:
Parameters:
Name Type Description
params Object
Properties
Name Type Attributes 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.

Extends

Members

(static) CELL_ACTIVATED_EVENT :string

Description:
  • Will be triggered when a row is "activated," or selected by the user, such as by
    double-clicking on it. The handler will receive the Table that triggered the
    event, and the Row and Column that were activated.

Source:
Since:
  • Niagara 4.12

Will be triggered when a row is "activated," or selected by the user, such as by
double-clicking on it. The handler will receive the Table that triggered the
event, and the Row and Column that were activated.

Type:
  • string
Example
dom.on(Table.CELL_ACTIVATED_EVENT, (event, table, activatedRow, activatedColumn) => {
  const activatedValue = activatedColumn.getValueFor(activatedRow); // value for the cell
  const activatedSubject = activatedRow.getSubject(); // value for the row
});

(static) ROW_SELECTION_CHANGED_EVENT :string

Description:
  • Will be triggered when rows are selected or deselected. The handler will receive the Table
    that triggered the event. Calculating which rows are selected is cheap but not free, so to
    protect performance in the case that the actual selected rows are not used, they will not
    be passed to the handler. To act on the newly selected rows, call table.getSelectedRows().

Source:
Since:
  • Niagara 4.12

Will be triggered when rows are selected or deselected. The handler will receive the Table
that triggered the event. Calculating which rows are selected is cheap but not free, so to
protect performance in the case that the actual selected rows are not used, they will not
be passed to the handler. To act on the newly selected rows, call table.getSelectedRows().

Type:
  • string
Example
dom.on(Table.ROW_SELECTION_CHANGED_EVENT, (event, table) => {
  const newSelectedRows = table.getSelectedRows();
});

Methods

$applyDensity()

Description:
  • Applies density property to the table.

Source:

$handleColumnEvent(tableModel, columns, eventName) → {Promise}

Source:
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

$initializePagination(model) → {Promise}

Description:
  • Arm event handlers on the loaded PaginationModel.

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

$rebuildThead(tableModel) → {Promise}

Source:
Parameters:
Name Type Description
tableModel module:nmodule/webEditors/rc/wb/table/model/TableModel
Returns:
Type
Promise

destroy() → {Promise}

Description:
  • Removes the editor class and emits a destroyed tinyevent.

Source:
Inherited From:
Returns:

call to module:bajaux/Widget#destroy

Type
Promise

doChanged()

Description:
  • Detect density property change and apply it to the table

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

doDestroy()

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

Source:

doInitialize(dom, params)

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

Source:
Parameters:
Name Type Description
dom JQuery
params Object

optional initialization parameters

doLoad(model) → {Promise}

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

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

if no TableModel provided

Type
Error
Returns:
Type
Promise

getModel() → {module:nmodule/webEditors/rc/wb/table/model/TableModel}

Description:
  • Get the currently loaded TableModel.

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

getSelectedRows() → {Array.<module:nmodule/webEditors/rc/wb/table/model/Row>}

Description:
  • Get all rows which are currently selected by the user.

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

getSubject(elem) → {Array.<*>}

Description:
  • 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.

Source:
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() → {Promise.<Array.<module:nmodule/export/rc/TransformOperation>>}

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

initialize(dom) → {Promise}

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

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

call to module:bajaux/Widget#initialize

Type
Promise

shouldValidate(flagopt) → {Boolean}

Description:
  • 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.

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

sort(column, desc) → {Promise|*}

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

    Override this if you want to override the sort ordering.

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