CollectionProxy

A collection is a set of data items, each with the same set of fields (though some data items may not have all
fields defined).

Extends


Constructors

new CollectionProxy()

new CollectionProxy(id, client): CollectionProxy

Parameters

ParameterTypeDescription
idstringID of this collection on the current document
clientEditorClient

Returns

CollectionProxy

Overrides

PropertyStoreProxy.constructor


Properties

client

protected readonly client: EditorClient;

Inherited from

PropertyStoreProxy.client


id

readonly id: string;

ID of this collection on the current document

Inherited from

PropertyStoreProxy.id


items

readonly items: MapProxy<string, DataItemProxy>;

The data items in this collection, organized by their primary key. The primary key is usually calculated
from the content of the data item, but may differ from the expected value in some circumstances, e.g. if
there are two data items that would have the same primary key.


properties

readonly properties: WriteableMapProxy<string, JsonSerializable, void, JsonSerializable>;

All properties available on this element, organized by name.
Not all properties are writeable (e.g. "ClassName" on a block).
To move or resize elements, use setLocation() or setBoundingBox() or offset() instead.

Inherited from

PropertyStoreProxy.properties


Methods

getBranchedFrom()

getBranchedFrom(): undefined | CollectionProxy

Some data collections may have local branches on the document, to store the set of changes that have been
made by the user since the time the data was last refreshed from its source. For those collections, you
can use this method to get the original data collection as it was last imported or refreshed.

Returns

undefined | CollectionProxy

the original collection from which this collection was branched, or undefined if this collection
is not a branch


getFields()

getFields(): string[]

Returns

string[]

an array of field names that are accessible on the items in this collection


getLocalChanges()

getLocalChanges(): undefined | PatchCollectionProxy

Returns

undefined | PatchCollectionProxy

information about any changes made locally to the collection that have not been synchronized
with the external data source.


getName()

getName(): string

Returns

string

a human-readable name for this collection


getSchema()

getSchema(): SchemaDefinition

Returns

SchemaDefinition


getSyncCollectionId()

getSyncCollectionId(): undefined | string

Returns

undefined | string


patchItems()

patchItems(patch): PatchDataItemsResult

Parameters

ParameterType
patchobject
patch.added?Record<string, SerializedFieldType>[]
patch.changed?Map<string, Record<string, SerializedFieldType>>
patch.deleted?string[]

Returns

PatchDataItemsResult