new (require("nmodule/webEditors/rc/wb/mgr/model/columns/MixinPropMgrColumn"))(type, prop [, params])
API Status: Development
MgrColumn that allows you to edit a property on a baja:IMixIn installed
on a component.
Extends:
Parameters:
| Name | Type | Argument | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
type |
Type | the |
|||||||||
prop |
String | baja.Slot | the property you wish to edit |
|||||||||
params |
Object |
<optional> |
Properties
|
Throws:
-
if Type or prop are missing, or if prop is not a frozen
slot on the given Type - Type
- Error
Methods
-
buildCell(row, dom)
-
Creates the cell's contents by calling
toStringon the row's proposed value
or the current value if there is no proposal. HTML will be safely escaped.Parameters:
Name Type Description rowmodule:nmodule/webEditors/rc/wb/table/model/Row domJQuery - Inherited From:
Returns:
- Type
- Promise
-
coalesceRows(rows)
-
Given the set of rows to be edited, coalesce their values into one single
value to load into an editor.By default, this will simply read the proposed value from the first row.
This is appropriate for a use case where one value will be entered and
written back to all edited components.If editing one value for all the given rows is not a use case supported by
your column (a good example is a Name column, because no two components can
share the same name), throw an error.Parameters:
Name Type Description rowsArray.<module:nmodule/webEditors/rc/wb/table/model/Row> - Inherited From:
Throws:
-
if rows array not given, or values from rows are not all
of the same type - Type
- Error
Returns:
value coalesced from the given rows
- Type
- *
-
commit(value, row [, params])
-
Sets the value to the mixin instance on the row's component. If the
component does not have an instance of the mixin, a new one will be
created.Parameters:
Name Type Argument Description valuebaja.Value rowmodule:nmodule/webEditors/rc/wb/table/model/Row paramsObject <optional>
Returns:
- 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 - Inherited From:
Returns:
- Type
- Promise | *
-
getColumnIcon()
-
Returns a URI for an icon representing this column. Returns
nullby
default; override as needed in subclasses.- Inherited From:
Returns:
a URI for an icon to be shown for this column.
- Type
- String
-
getConfigFor(rows)
-
When creating an editor for this column, use the value coalesced from the
given rows, and respect any slot Facets on the mixin Type.Parameters:
Name Type Description rowsArray.<module:nmodule/webEditors/rc/wb/table/model/Row> Returns:
config with value and facets
- Type
- Object
-
getFlags()
-
Get the flags set on this column.
- Inherited From:
Returns:
- Type
- Number
-
getName()
-
Get the column name or
nullif none was given.- Inherited From:
Returns:
- Type
- String
-
getProposedValueFor(row)
-
Get the currently proposed value for the given row. If no value proposed
yet, will return the actual column value (getValueFor).Parameters:
Name Type Description rowmodule:nmodule/webEditors/rc/wb/table/model/Row Returns:
- Type
- *
-
getValueFor(row)
-
Get the property from the mixin instance on this row's component. If
the component does not have an instance of that mixin (e.g. it is an
unmounted component created browser-side), the default value from an
instance of that mixin will be returned.Parameters:
Name Type Description rowmodule:nmodule/webEditors/rc/wb/table/model/Row Returns:
- Type
- baja.Value
-
hasFlags(flags)
-
Return true if the column has all of the given flags.
Parameters:
Name Type Description flagsNumber flags to check for
- Inherited From:
Returns:
- Type
- Boolean
-
isEditable()
-
Return true if the column is editable.
- Inherited From:
Returns:
- Type
- Boolean
-
isEditorSuitable(editor, rows)
-
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.Parameters:
Name Type Description editormodule:nmodule/webEditors/rc/fe/baja/BaseEditor rowsArray.<module:nmodule/webEditors/rc/wb/table/model/Row> Returns:
- Type
- Boolean
-
isExportable()
-
Return true if the column should show up in export operations, e.g. to CSV.
- Since:
-
- Niagara 4.8
- 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
-
mgrValidate(model, data [, params])
-
Allows this column to validate proposed changes.
Parameters:
Name Type Argument Description modelmodule:nmodule/webEditors/rc/wb/mgr/model/MgrModel the model to which we're about to apply changes.
dataArray an array of proposed changes to this column, one per
row in theMgrModel. If a value in this array is null, no change has
been proposed for that row.paramsObject <optional>
Properties
Name Type Argument Description editormodule: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.- Inherited From:
Returns:
promise that resolves by default
- Type
- Promise
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')); } } }; -
propose(value, row)
-
Should read the value and "tentatively" apply it to the
selected row. In most cases this will be setting some temporary data
for display-only purposes.By default, will set some temporary data on the row using the column's
name as a key.Parameters:
Name Type Description value* rowmodule:nmodule/webEditors/rc/wb/table/model/Row - Inherited From:
Returns:
- Type
- Promise
-
setEditable(editable)
-
Set or unset the column's
EDITABLEflag. Emits aflagsChangedevent.Parameters:
Name Type Description editableboolean - Inherited From:
-
setExportable(exportable)
-
Set or unset whether the column should show up in export operations.
Parameters:
Name Type Description exportableboolean - Since:
-
- Niagara 4.8
- Inherited From:
-
setFlags(flags)
-
Set the column's flags.
Parameters:
Name Type Description flagsNumber - 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 hidableboolean - Inherited From:
-
setReadonly(readonly)
-
Set or unset the column's
READONLYflag. Emits aflagsChangedevent.Parameters:
Name Type Description readonlyboolean - Inherited From:
-
setSortable(sortable)
-
Set or unset whether the column should be allowed to be sorted by the table heading.
Parameters:
Name Type Description sortableboolean - Inherited From:
-
setUnseen(unseen)
-
Set or unset the column's
UNSEENflag. Emits aflagsChangedevent.Parameters:
Name Type Description unseenboolean - Inherited From:
-
toDisplayName()
-
Resolves a display name for this column.
- 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 inPromise.resolve()when appropriate.- Type
- Promise | *