module:nmodule/webEditors/rc/wb/table/model/ComponentSource

module:nmodule/webEditors/rc/wb/table/model/ComponentSource

new (require("nmodule/webEditors/rc/wb/table/model/ComponentSource"))(obj)

Description:
  • API Status: Development

    For use with a ComponentTableModel, acts as a source of components to
    load into table rows.

    This should be overridden to provide components from different kinds of
    sources; e.g. search results. Each subclass must obey the following
    contract:

    • getComponents() returns an array of all available components
    • added and removed events are emitted when the list of components
      changes (to notify the ComponentTableModel to add or remove rows).
      These should be fired with arrays of all components that were just
      added or removed.
    • changed events are emitted when one of the components in the list
      has been changed (to notify the ComponentTableModel that row contents
      have changed). These should be fired once per component that changed,
      with two arguments: the component that changed, and the property on that
      component that changed.
Source:
Mixes In:
  • tinyevents
See:
Parameters:
Name Type Description
obj Object | baja.Component

params object, or the container itself

Properties
Name Type Description
container Object

the Component container

Methods

(abstract) addComponents(comps, namesopt) → {Promise.<Array.<baja.Component>>}

Description:
  • Add new components to this component source. Must be implemented by
    subclasses and emit added event as appropriate.

Source:
Parameters:
Name Type Attributes Description
comps Array.<baja.Component>
names Array.<String> <optional>

desired names for the components; may not
always be respected by subclasses

Throws:

if not implemented

Type
Error
Returns:

as of Niagara 4.13, will be
resolved with the actual component instances after they are added

Type
Promise.<Array.<baja.Component>>

destroy()

Description:
  • Clean up event handlers associated with this component source.

Source:

(abstract) getComponents() → {Array.<baja.Component>}

Description:
  • Gets an array of all matching child Components of the container. Must
    be implemented by subclasses.

Source:
Throws:

if not implemented

Type
Error
Returns:
Type
Array.<baja.Component>

getContainer() → {Object}

Description:
  • The container object passed to the constructor.

Source:
Returns:
Type
Object

(abstract) removeComponents(comps) → {Promise}

Description:
  • Remove these components from this component source. Must be implemented
    by subclasses and emit removed event as appropriate.

Source:
Parameters:
Name Type Description
comps Array.<baja.Component>
Throws:

if not implemented

Type
Error
Returns:
Type
Promise