new (require("nmodule/webEditors/rc/wb/table/model/Column"))(nameopt, paramsopt)
- Description:
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 acontextvalue.
- Source:
- 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!' });
Parameters:
| Name | Type | Attributes | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
name |
String |
<optional> |
column name |
||||||||||||
params |
Object |
<optional> |
Properties
|
Members
(static) flags :Object
- Description:
Available configuration flags for a Column.
- Source:
Available configuration flags for a Column.
Type:
- Object
Methods
buildCell(row, dom) → {Promise|*}
- Description:
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.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
row |
module:nmodule/webEditors/rc/wb/table/model/Row | |
dom |
JQuery |
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 in Promise.resolve() when appropriate.
- 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 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().
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
row |
module:nmodule/webEditors/rc/wb/table/model/Row | |
dom |
JQuery |
Returns:
- Type
- Promise | *
getColumnIcon() → {String}
- Description:
Returns a URI for an icon representing this column. Returns
nullby
default; override as needed in subclasses.
- Source:
Returns:
a URI for an icon to be shown for this column.
- Type
- String
getFlags() → {Number}
- Description:
Get the flags set on this column.
- Source:
Returns:
- Type
- Number
getName() → {String}
- Description:
Get the column name or
nullif none was given.
- Source:
Returns:
- Type
- String
(abstract) getValueFor(row) → {*}
- Description:
Override point; each column should define its own method of retrieving a
value from the given table row.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
row |
module: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) → {Boolean}
- Description:
Return true if the column has all of the given flags.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
flags |
Number | flags to check for |
Returns:
- Type
- Boolean
isEditable() → {Boolean}
- Description:
Return true if the column is editable.
- Source:
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
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:
Returns:
- Type
- Boolean
isReadonly() → {Boolean}
- Description:
Return true if the column is readonly.
- Source:
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:
Returns:
- Type
- Boolean
isUnseen() → {Boolean}
- Description:
Return true if the column is unseen.
- Source:
Returns:
- Type
- Boolean
setEditable(editable)
- Description:
Set or unset the column's
EDITABLEflag. Emits aflagsChangedevent.
- Source:
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
Parameters:
| Name | Type | Description |
|---|---|---|
exportable |
boolean |
setFlags(flags)
- Description:
Set the column's flags.
- Source:
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:
Parameters:
| Name | Type | Description |
|---|---|---|
hidable |
boolean |
setReadonly(readonly)
- Description:
Set or unset the column's
READONLYflag. Emits aflagsChangedevent.
- Source:
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:
Parameters:
| Name | Type | Description |
|---|---|---|
sortable |
boolean |
setUnseen(unseen)
- Description:
Set or unset the column's
UNSEENflag. Emits aflagsChangedevent.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
unseen |
boolean |
toDisplayName() → {Promise|*}
- Description:
Resolves a display name for this column.
- Source:
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 | *