new (require("nmodule/webEditors/rc/wb/table/model/Column"))( [name] [, params])
API Status: Development
Column for use in a TableModel.
As of Niagara 4.8, arbitrary data can be stored on a Column instance. To
enable tables and table exporters to use a context object when formatting
table cells, add a context value.
Parameters:
| Name | Type | Argument | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
name |
String |
<optional> |
column name |
||||||||||||
params |
Object |
<optional> |
Properties
|
- Mixes In:
- tinyevents
- module:nmodule/webEditors/rc/mixin/DataMixin
- See:
Example
Append context data for formatting use in tables and table exporters.
const myBooleanColumn = new Column('myBoolean');
myBooleanColumn.data('context', { trueText: 'Yes!', falseText: 'No!' });
Members
-
<static> flags :Object
-
Available configuration flags for a Column.
Type:
- Object
Methods
-
buildCell(row, dom)
-
Builds out the DOM element, typically a
td, that represents the
intersection of this column with a particular row. Often this will simply
be a simpletoString()or similar, but could also do more sophisticated
things like build widgets.Parameters:
Name Type Description rowmodule:nmodule/webEditors/rc/wb/table/model/Row domJQuery Returns:
promise to be resolved when the element's contents
have 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 inPromise.resolve()when appropriate.- Type
- Promise | *
-
destroyCell(row, dom)
-
Called when the table is destroying the DOM element built for a cell in this column. This
gives aColumnimplementation 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 toPromise.resolve().Parameters:
Name Type Description rowmodule:nmodule/webEditors/rc/wb/table/model/Row domJQuery Returns:
- Type
- Promise | *
-
getColumnIcon()
-
Returns a URI for an icon representing this column. Returns
nullby
default; override as needed in subclasses.Returns:
a URI for an icon to be shown for this column.
- Type
- String
-
getFlags()
-
Get the flags set on this column.
Returns:
- Type
- Number
-
getName()
-
Get the column name or
nullif none was given.Returns:
- Type
- String
-
<abstract> getValueFor(row)
-
Override point; each column should define its own method of retrieving a
value from the given table row.Parameters:
Name Type Description rowmodule:nmodule/webEditors/rc/wb/table/model/Row Throws:
-
if not implemented
- Type
- Error
Returns:
the row value. Note that this is synchronous; if the row's
subject is not ready to provide a value, it should not be loaded into the
table.- Type
- *
-
-
hasFlags(flags)
-
Return true if the column has all of the given flags.
Parameters:
Name Type Description flagsNumber flags to check for
Returns:
- Type
- Boolean
-
isEditable()
-
Return true if the column is editable.
Returns:
- Type
- Boolean
-
isExportable()
-
Return true if the column should show up in export operations, e.g. to CSV.
- Since:
-
- Niagara 4.8
Returns:
- Type
- Boolean
-
isHidable()
-
Return true if the column should available in the table's show/hide context menu.
Defaults to true.Returns:
- Type
- Boolean
-
isReadonly()
-
Return true if the column is readonly.
Returns:
- Type
- Boolean
-
isSortable()
-
Returns a boolean indicating whether the column should not be sortable via the table headings.
Defaults to true.Returns:
- Type
- Boolean
-
isUnseen()
-
Return true if the column is unseen.
Returns:
- Type
- Boolean
-
setEditable(editable)
-
Set or unset the column's
EDITABLEflag. Emits aflagsChangedevent.Parameters:
Name Type Description editableboolean -
setExportable(exportable)
-
Set or unset whether the column should show up in export operations.
Parameters:
Name Type Description exportableboolean - Since:
-
- Niagara 4.8
-
setFlags(flags)
-
Set the column's flags.
Parameters:
Name Type Description flagsNumber 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 hidableboolean -
setReadonly(readonly)
-
Set or unset the column's
READONLYflag. Emits aflagsChangedevent.Parameters:
Name Type Description readonlyboolean -
setSortable(sortable)
-
Set or unset whether the column should be allowed to be sorted by the table heading.
Parameters:
Name Type Description sortableboolean -
setUnseen(unseen)
-
Set or unset the column's
UNSEENflag. Emits aflagsChangedevent.Parameters:
Name Type Description unseenboolean -
toDisplayName()
-
Resolves a display name for this column.
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 inPromise.resolve()when appropriate.- Type
- Promise | *