An observable collection of
Entity instances where each entity has a unique id.
| Name | Type | Description |
|---|---|---|
owner |
DataSource | CompositeEntityCollection | optional 创建此集的数据源(或复合实体集). |
Members
readonly collectionChanged : Event.<EntityCollection.CollectionChangedEventCallback>
获取当实体被添加或从收藏中移除时被发射的事件.
生成的事件为
EntityCollection.CollectionChangedEventCallback .
获取此收藏的全球独有标识符 .
readonly owner : DataSource|CompositeEntityCollection
得到这个实体收藏的主人,ie。 创建该数据库的数据源或复合实体的收集.
获取此实体收藏是否应该
显示。 当真实时,每个实体仅在
它自己的表演财产也是真实的.
readonly values : Array.<Entity>
Gets the array of Entity instances in the collection.
此数组不应直接修改 .
Methods
add(entity) → Entity
在收藏中添加一个实体 .
| Name | Type | Description |
|---|---|---|
entity |
Entity | Entity.ConstructorOptions | 拟加实体. |
Returns:
添加的实体.
Throws:
-
DeveloperError : An entity with
already exists in this collection.
computeAvailability() → TimeInterval
计算收藏中实体的最大可用性.
如果收集中包含无限可得数据和非无限数据的组合,
它只返回与非无限数据有关的间隔。 如果有的话
数据是无限的,将返回一个无限的间隔.
Returns:
收藏中实体的有无.
如果提供的实体在此收藏中, 则返回真实性, 否则是虚假的 .
| Name | Type | Description |
|---|---|---|
entity |
Entity | The entity. |
Returns:
如果所提供实体在此集合中,则不实.
getById(id) → Entity|undefined
获取带有指定标识的实体.
| Name | Type | Description |
|---|---|---|
id |
string | 取回实体的ID. |
Returns:
如果收藏中id不存在,则提供id或未定义的实体.
getOrCreateEntity(id) → Entity
获取指定的 id 或创建它的实体,如果不存在,则将其添加到收藏中.
| Name | Type | Description |
|---|---|---|
id |
string | 要获取或创建的实体的 ID . |
Returns:
新对象或已有对象.
从收藏中删除一个实体.
| Name | Type | Description |
|---|---|---|
entity |
Entity | 要删除的实体. |
Returns:
如果项被移除, 如果收藏中不存在, 则为真.
从收藏中删除所有实体.
从收藏中删除一个带有提供 ID 的实体.
| Name | Type | Description |
|---|---|---|
id |
string | 要删除的实体的 ID . |
Returns:
如果物品被移除, 如果收藏中不存在提供的身份标识, 则为假.
Resumes raising
EntityCollection#collectionChanged events immediately
当某一项被添加或删除时。 活动暂停期间所作的任何修改
当调用此函数时, 将会作为单个事件触发.
此函数被计算为参考, 只要有, 可以安全地调用多次
are corresponding calls to EntityCollection#resumeEvents.
Throws:
-
DeveloperError : resumeEvents can not be called before suspendEvents.
Prevents
EntityCollection#collectionChanged events from being raised
until a corresponding call is made to EntityCollection#resumeEvents, at which
点将提出一个涵盖所有暂停操作的事件.
这样可以有效地添加和删除许多项目.
只要有, 此函数可以安全调用多次
are corresponding calls to EntityCollection#resumeEvents.
Type Definitions
The signature of the event generated by
EntityCollection#collectionChanged.
| Name | Type | Description |
|---|---|---|
collection |
EntityCollection | 引发事件的收藏. |
added |
Array.<Entity> |
The array of Entity instances that have been added to the collection. |
removed |
Array.<Entity> |
The array of Entity instances that have been removed from the collection. |
changed |
Array.<Entity> |
The array of Entity instances that have been modified. |