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


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

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.
Parameters:
Name Type Description
obj Object | baja.Component

params object, or the container itself

Properties
Name Type Description
container Object

the Component container

Mixes In:
  • tinyevents
See:

Methods


<abstract> addComponents(comps [, names])

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

Parameters:
Name Type Argument 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:
Type
Promise

destroy()

Clean up event handlers associated with this component source.


<abstract> getComponents()

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

Throws:

if not implemented

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

getContainer()

The container object passed to the constructor.

Returns:
Type
Object

<abstract> removeComponents(comps)

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

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

if not implemented

Type
Error
Returns:
Type
Promise