attachItems()
Enable (or disable) automatic attachment of new objects to the list itself.
attachItems(set: boolean, noEventPropagation?: boolean): this;
Summary
This method can be used to make the list contain all of its (current and new) items by attaching them. After enabling automatic attachment, adding an object to the list immediately attaches it; removing an object from the list unlinks it (since it’s no longer attached); attaching an object to another object (or list) removes it from the list (since it can no longer be attached) — but the object won’t be unlinked.
When enabled, if the list currently contains any objects, they’re immediately attached. Note that the feature can’t be disabled once it has been enabled and there are any objects in the list.
When enabled, events emitted on any object in the list are automatically re-emitted on the list itself (propagating the event) — unless the noEventPropagation argument is set to true, or the ObservableEvent.noPropagation property is set on the event itself.
Parameters
- set — True if all new objects should be attached to the list
- noEventPropagation — True if events should not be re-emitted on the list itself
Errors
This method throws an error if the feature can’t be enabled or disabled.
Related
class ObservableList
A data structure that contains an ordered set of observable objects.
