module:nmodule/webEditors/rc/wb/mgr/model/columns/TypeMgrColumn

module:nmodule/webEditors/rc/wb/mgr/model/columns/TypeMgrColumn

new (require("nmodule/webEditors/rc/wb/mgr/model/columns/TypeMgrColumn"))()

Description:
  • API Status: Development

    Manager column used to display and edit the component type of a row.

Source:
Extends:

Extends

Members

(static) DISCOVERY_DATA_KEY :String

Description:
  • The TypeMgrColumn key for the discovery object in Row.data()

Source:

The TypeMgrColumn key for the discovery object in Row.data()

Type:
  • String

(static) SELECTED_TYPE_KEY :String

Description:
  • The TypeMgrColumn key for the selected TypeInfo in Row.data()

Source:

The TypeMgrColumn key for the selected TypeInfo in Row.data()

Type:
  • String

Methods

buildCell(row, dom)

Description:
  • Builds the cell contents using the type's display name.

Source:
Overrides:
Parameters:
Name Type Description
row module:nmodule/webEditors/rc/wb/table/model/Row
dom JQuery

coalesceRows(rows) → {baja.DynamicEnum|string}

Description:
  • For the given array of rows, this will produce a single value from
    from the intersection of the available types. The types will have been
    set as a data value on the row by either the NewCommand or AddCommand.
    This will create a dynamic enum with each tag representing one of the
    intersected types.

Source:
Overrides:
Parameters:
Name Type Description
rows Array.<module:nmodule/webEditors/rc/wb/table/model/Row>
Throws:

if not every row has a type to choose from (i.e. the rows
are being edited, not added)

Type
Error
Returns:
Type
baja.DynamicEnum | string

commit(value, row, paramsopt) → {Promise}

Description:
  • Should read the value and "officially" apply it back to the selected rows.
    If params.batch is received, then params.progressCallback must be
    called with MgrColumn.COMMIT_READY when this function is done using that
    batch (even if no network calls are added to it).

    Note: sometimes you may want to abort the entire process of saving changes
    to the Manager, for instance, if one of your columns requires the user to
    confirm a dialog before committing. Returning a Promise that rejects will
    show an error dialog to the user, which may not be what you want if you've
    already shown a dialog. Another option is to return a Promise that never
    resolves or rejects, which will drop the user back at the edit screen
    without committing any changes (all commit calls must resolve for any
    changes to post to the station). A more explicit API for this may be
    provided in the future.

Source:
Inherited From:
Parameters:
Name Type Attributes Description
value *

the proposed value to commit to the row

row module:nmodule/webEditors/rc/wb/table/model/Row
params Object <optional>
Properties
Name Type Attributes Description
editor module:nmodule/webEditors/rc/fe/baja/BaseEditor <optional>

the editor from which the value was read. If the column is not editable,
this parameter will be undefined, as no editor will have been created for
the value. This situation may occur when a value obtained via discovery is
set on row for a non-editable column.

batch baja.comm.Batch <optional>

a batch to use to commit changes
up to the station

progressCallback function <optional>

call this with
MgrColumn.COMMIT_READY when this function is done adding network calls to
the batch.

Returns:
Type
Promise

destroyCell(row, dom) → {Promise|*}

Description:
  • Called when the table is destroying the DOM element built for a cell in this column. This
    gives a Column implementation the chance to clean up any resources that might have been
    created during the earlier call to #buildCell, perhaps destroying a widget in the cell,
    for example. As with #buildCell, if this completes synchronously and doesn't return a
    Promise, the caller must wrap this in a call to Promise.resolve().

Source:
Inherited From:
Parameters:
Name Type Description
row module:nmodule/webEditors/rc/wb/table/model/Row
dom JQuery
Returns:
Type
Promise | *

getColumnIcon() → {baja.Icon}

Description:
  • Return the icon to be used for the column in the batch component editor.

Source:
Overrides:
Returns:
Type
baja.Icon

getConfigFor(rows) → {Object}

Description:
  • Create the config object for the editor based on the coalesced value.

Source:
Overrides:
Parameters:
Name Type Description
rows Array.<module:nmodule/webEditors/rc/wb/table/model/Row>
Throws:

if not every row has a type to choose from (i.e. the rows
are being edited, not added)

Type
Error
Returns:
Type
Object

getFlags() → {Number}

Description:
  • Get the flags set on this column.

Source:
Inherited From:
Returns:
Type
Number

getName() → {String}

Description:
  • Get the column name or null if none was given.

Source:
Inherited From:
Returns:
Type
String

getProposedValueFor(row) → {*}

Description:
  • Get the currently proposed value for the given row. If no value proposed
    yet, will return the actual column value (getValueFor).

Source:
Inherited From:
Parameters:
Name Type Description
row module:nmodule/webEditors/rc/wb/table/model/Row
Returns:
Type
*

getValueFor(row) → {baja.Type}

Description:
  • Returns the baja.Type of the Row's subject as the value.

Source:
Overrides:
Parameters:
Name Type Description
row module:nmodule/webEditors/rc/wb/table/model/Row
Returns:
Type
baja.Type

hasFlags(flags) → {Boolean}

Description:
  • Return true if the column has all of the given flags.

Source:
Inherited From:
Parameters:
Name Type Description
flags Number

flags to check for

Returns:
Type
Boolean

isEditable() → {Boolean}

Description:
  • Return true if the column is editable.

Source:
Inherited From:
Returns:
Type
Boolean

isEditorSuitable(editor, rows) → {Boolean}

Description:
  • If an editor has already been built, it may be possible to reuse it,
    simply loading in a new coalesced value rather than destroying and
    rebuilding the existing editor.

    This function should return true if the editor is suitable to be reused
    for the given rows. By default, will always return true.

Source:
Inherited From:
Parameters:
Name Type Description
editor module:nmodule/webEditors/rc/fe/baja/BaseEditor
rows Array.<module:nmodule/webEditors/rc/wb/table/model/Row>
Returns:
Type
Boolean

isExportable() → {Boolean}

Description:
  • Return true if the column should show up in export operations, e.g. to CSV.

Source:
Since:
  • Niagara 4.8
Inherited From:
Returns:
Type
Boolean

isHidable() → {Boolean}

Description:
  • Return true if the column should available in the table's show/hide context menu.
    Defaults to true.

Source:
Inherited From:
Returns:
Type
Boolean

isReadonly() → {Boolean}

Description:
  • Return true if the column is readonly.

Source:
Inherited From:
Returns:
Type
Boolean

isSortable() → {Boolean}

Description:
  • Returns a boolean indicating whether the column should not be sortable via the table headings.
    Defaults to true.

Source:
Inherited From:
Returns:
Type
Boolean

isUnseen() → {Boolean}

Description:
  • Return true if the column is unseen.

Source:
Inherited From:
Returns:
Type
Boolean

mgrValidate(model, data, paramsopt) → {Promise}

Description:
  • Allows this column to validate proposed changes.

Source:
Inherited From:
Example

Validating this column may require that I examine the changes I'm about to make to other columns as well.

MyMgrColumn.prototype.mgrValidate = function (model, data, params) {
  var that = this,
      rows = model.getRows(),
      otherColumn = model.getColumn('otherColumn');

  //search through all MgrModel rows, and check to see that my proposed
  //change is compatible with the proposed change to another column.
  //say, i'm a "password" column, and the other column is a "password
  //scheme" column - i need to make sure that the proposed password is
  //considered valid by the proposed password scheme.

  for (var i = 0; i < rows.length; i++) {
    var row = rows[i],
        myValue = data[i],
        otherValue = otherColumn.getProposedValueFor(row);

    if (myValue === null) {
      //no changes proposed for this row, so nothing to validate.
    }

    if (!isCompatible(myValue, otherValue)) {
      return Promise.reject(new Error('incompatible values'));
    }
  }
};
Parameters:
Name Type Attributes Description
model module:nmodule/webEditors/rc/wb/mgr/model/MgrModel

the model to which we're about to apply changes.

data Array

an array of proposed changes to this column, one per
row in the MgrModel. If a value in this array is null, no change has
been proposed for that row.

params Object <optional>
Properties
Name Type Attributes Description
editor module:nmodule/webEditors/rc/fe/baja/BaseEditor <optional>

the editor from which the proposed values were read. Note that the editor
may have been used to edit other rows, so the editor's current value may
not match the proposed new values.

Returns:

promise that resolves by default

Type
Promise

newInstance(mgrModel, row) → {Promise.<baja.Value>}

Description:
  • Return a new instance for the selected type.

Source:
Parameters:
Name Type Description
mgrModel module:nmodule/webEditors/rc/wb/mgr/model/MgrModel
row module:nmodule/webEditors/rc/wb/table/model/Row
Returns:
Type
Promise.<baja.Value>

propose(value, row) → {Promise}

Description:
  • Set the proposed value for the Row. This will normally be the DynamicEnum
    created by the coalesceRows() function.

Source:
Overrides:
Parameters:
Name Type Description
value *
row module:nmodule/webEditors/rc/wb/table/model/Row
Returns:
Type
Promise

setEditable(editable)

Description:
  • Set or unset the column's EDITABLE flag. Emits a flagsChanged event.

Source:
Inherited From:
Parameters:
Name Type Description
editable boolean

setExportable(exportable)

Description:
  • Set or unset whether the column should show up in export operations.

Source:
Since:
  • Niagara 4.8
Inherited From:
Parameters:
Name Type Description
exportable boolean

setFlags(flags)

Description:
  • Set the column's flags.

Source:
Inherited From:
Parameters:
Name Type Description
flags Number
Throws:

if a non-Number given

Type
Error

setHidable(hidable)

Description:
  • Set or unset whether the column should be allowed to be hidden or shown by the table's
    show/hide context menu.

Source:
Inherited From:
Parameters:
Name Type Description
hidable boolean

setReadonly(readonly)

Description:
  • Set or unset the column's READONLY flag. Emits a flagsChanged event.

Source:
Inherited From:
Parameters:
Name Type Description
readonly boolean

setSortable(sortable)

Description:
  • Set or unset whether the column should be allowed to be sorted by the table heading.

Source:
Inherited From:
Parameters:
Name Type Description
sortable boolean

setUnseen(unseen)

Description:
  • Set or unset the column's UNSEEN flag. Emits a flagsChanged event.

Source:
Inherited From:
Parameters:
Name Type Description
unseen boolean

toDisplayName() → {Promise|*}

Description:
  • Resolves a display name for this column.

Source:
Inherited From:
Returns:

promise to be resolved when the element's display name
has been fully built. It's also acceptable for overrides of this function
to complete synchronously without returning a promise, so be sure to wrap
calls to this function in Promise.resolve() when appropriate.

Type
Promise | *