Fork me on GitHub
Show:

SubsetCollection

Extends aeris.Collection

Summary

A collection which acts as a subset of another (source) collection.

A SubsetCollection defines rules for filtering models from a source collection. The SubsetCollection will sync to all changes in the source collection. If filtered rules are changed on the SubsetCollection, it will be updated with models from the soure collection accordingly

Constructor

aeris.util.aeris.SubsetCollection

Syntax

aeris.util.aeris.SubsetCollection

(
  • sourceCollection
  • opt_options
)

Summary

Parameters:

Methods

bindToSourceCollection_

Syntax

bindToSourceCollection_

() private

Summary

fetch

Syntax

fetch

(
  • opt_options
)
Promise

Summary

Fetches data from the underlying source collection.

Parameters:

Returns:

getFilteredSourceModels_

Syntax

getFilteredSourceModels_

() Array.<Model> protected

Summary

Returns:

Array.<Model>:

Models from the source collection which pass subset filtering rules.

getSourceCollection

Syntax

getSourceCollection

() Collection

Summary

Returns:

isOverLimit

Syntax

isOverLimit

() Boolean

Summary

Returns:

isUnderLimit

Syntax

isUnderLimit

() Boolean

Summary

Does the collection have fewer models than the specified limit?

If no limit is set, this will always return true.

Returns:

normalizeSourceCollection_

Syntax

normalizeSourceCollection_

() private

Summary

proxyRequestEvents_

Syntax

proxyRequestEvents_

() private

Summary

removeFilter

Syntax

removeFilter

()

Summary

Stops filtering models from the source collection.

removeLimit

Syntax

removeLimit

()

Summary

Stops limiting the number of models from the source collection to set on the SubsetCollection.

resetToSourceModel_

Syntax

resetToSourceModel_

() private

Summary

setFilter

Syntax

setFilter

(
  • filter
  • opt_ctx
)

Summary

Sets a filter to be used when syncing the SubsetCollection to it's source collection.

The filter receives a source collection models as an argument. If the filter returns true, the model will be added to the SubsetCollection.

Set the filter to null to disable filtering.

Parameters:

setLimit

Syntax

setLimit

(
  • limit
)

Summary

Limits the number of models from the source collection to set on the SubsetCollection.

Parameters:

Properties

filter_

Syntax

filter_

?function():Boolean private

Summary

limit_

Syntax

limit_

?number If null, no limit is enforced. protected

Summary