Module: nmodule/webEditors/rc/wb/table/model/columns/PropertyColumn


new (require("nmodule/webEditors/rc/wb/table/model/columns/PropertyColumn"))(prop [, params])

API Status: Development

Column for showing the value of a Complex's Property slot.

Extends:
Parameters:
Name Type Argument Description
prop String | baja.Slot

the property slot to read from a Complex

params Object <optional>
Properties
Name Type Argument Description
type Type <optional>

if reading a frozen slot, pass in the Type
instance to be able to resolve the display name/facets for that frozen slot

getDefaultValue function <optional>

a function to provide a custom
default value for getValueFor to return if the row's Complex does not
have the column prop. The function will be passed the row's Complex.

Methods


buildCell(row, dom)

Shows a display string of the desired property value of the row's
loaded Complex.

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

promise to be resolved with a display string

Type
Promise

destroyCell(row, dom)

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().

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

getColumnIcon()

If a type param was given, then return an icon for the given slot on
that type. Otherwise, return null.

Overrides:
Returns:
Type
String

getFlags()

Get the flags set on this column.

Inherited From:
Returns:
Type
Number

getName()

Get the column name or null if none was given.

Inherited From:
Returns:
Type
String

getValueFor(row)

Get the value of the Property specified in the constructor from the row's
loaded Complex.

If the Complex does not have that Property:

If a getDefaultValue param was passed into this column's constructor, the
row's Complex will be passed into the function and the result will be
returned.

If a type param was passed into this column's constructor, the value
of the property from the default instance of the given type will be
returned.

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

if the row does not actually have a Complex loaded, or
does not have the specified Property (and type is unknown)

Type
Error
Returns:

the Property value read from the Complex

Type
baja.Value

hasFlags(flags)

Return true if the column has all of the given flags.

Parameters:
Name Type Description
flags Number

flags to check for

Inherited From:
Returns:
Type
Boolean

isEditable()

Return true if the column is editable.

Inherited From:
Returns:
Type
Boolean

isHidable()

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

Inherited From:
Returns:
Type
Boolean

isReadonly()

Return true if the column is readonly.

Inherited From:
Returns:
Type
Boolean

isSortable()

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

Inherited From:
Returns:
Type
Boolean

isUnseen()

Return true if the column is unseen.

Inherited From:
Returns:
Type
Boolean

setEditable(editable)

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

Parameters:
Name Type Description
editable boolean
Inherited From:

setFlags(flags)

Set the column's flags.

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

if a non-Number given

Type
Error

setHidable(hidable)

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

Parameters:
Name Type Description
hidable boolean
Inherited From:

setReadonly(readonly)

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

Parameters:
Name Type Description
readonly boolean
Inherited From:

setSortable(sortable)

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

Parameters:
Name Type Description
sortable boolean
Inherited From:

setUnseen(unseen)

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

Parameters:
Name Type Description
unseen boolean
Inherited From:

toDisplayName()

Resolves the display name of the property slot.

Overrides:
Returns:

promise to be resolved with the display name

Type
Promise