AssignmentStore

A store representing a collection of assignments between events in the EventStore and resources in the ResourceStore.

This store only accepts a model class inheriting from AssignmentModel.

An AssignmentStore is usually connected to a project, which binds it to other related stores (EventStore, ResourceStore and DependencyStore). The project also handles references (event, resource) to related records for the records in the store.

Resolving the references happens async, records are not guaranteed to have up to date references until calculations are finished. To be certain that references are resolved, call await project.commitAsync() after store actions. Or use one of the xxAsync functions, such as loadDataAsync().

Using commitAsync():

assignmentStore.data = [{ eventId, resourceId }, ...];

// references (event, resource) not resolved yet

await assignmentStore.project.commitAsync();

// now they are

Using loadDataAsync():

await assignmentStore.loadDataAsync([{ eventId, resourceId }, ...]);

// references (event, resource) are resolved

Configs

80

Common

autoCommitStoreCRUD
autoLoadAjaxStore
dataStore
fieldsStore
groupersStoreGroup
idStore
listenersEvents
sortersStoreSort

Advanced

stmStoreStm
storageStore
useLocaleSortStoreSort

Chained store

chainedFieldsStoreChained
chainedFilterFnStoreChained
chainFiltersStoreChained
dontRelayToMasterStoreChained
doRelayToMasterStoreChained
ignoreLinkRecordsStoreChained
masterStoreStoreChained
syncOrderStoreChained
syncSortStoreChained

CRUD

createUrlAjaxStore
deleteUrlAjaxStore
readUrlAjaxStore
updateUrlAjaxStore

Filtering

filtersStoreFilter
remoteFilterStoreFilter

Misc

Other

lazyLoadAjaxStore
useSparseIndexStoreSparseIndex

Paging

pageParamNameStorePaging
pageSizeStorePaging
remotePagingStorePaging

Records

Remote

fetchOptionsAjaxStore
filterParamNameStoreFilter
headersAjaxStore
httpMethodsAjaxStore
paramsAjaxStore
paramsInBodyAjaxStore
restfulFilterAjaxStore

Sorting

remoteSortStoreSort
sortParamNameStoreSort

Tree

treeStore

Properties

77

Common

idStore

Class hierarchy

isAssignmentStore: Boolean= truereadonly
Identifies an object as an instance of AssignmentStore class, or subclass thereof.
isAssignmentStore: Boolean= truereadonlystatic
Identifies an object as an instance of AssignmentStore class, or subclass thereof.
Identifies an object as an instance of AssignmentStoreMixin class, or subclass thereof.
isAssignmentStoreMixin: Boolean= truereadonlystaticAssignmentStoreMixin
Identifies an object as an instance of AssignmentStoreMixin class, or subclass thereof.
isAjaxStoreAjaxStore
isEventsEvents
isPartOfProjectPartOfProject
isStoreStore
isStoreChainedStoreChained
isStoreChangesStoreChanges
isStoreCRUDStoreCRUD
isStoreFilterStoreFilter
isStoreGroupStoreGroup
isStorePagingStorePaging
isStoreRelationStoreRelation
isStoreSearchStoreSearch
isStoreSortStoreSort
isStoreSparseIndexStoreSparseIndex
isStoreStateStoreState
isStoreStmStoreStm
isStoreSumStoreSum
isStoreSyncStoreSync
isStoreTreeStoreTree

Records

Applies a new dataset to the AssignmentStore. Use it to plug externally fetched data into the store.

NOTE: References (assignments, resources) on the assignments are determined async by a calculation engine. Thus they cannot be directly accessed after assigning the new dataset.

For example:

assignmentStore.data = [{ eventId, resourceId }];
// assignmentStore.first.event is not yet available

To guarantee references are available, wait for calculations for finish:

assignmentStore.data = [{ eventId, resourceId  }];
await assignmentStore.project.commitAsync();
// assignmentStore.first.event is available

Alternatively use loadDataAsync() instead:

await assignmentStore.loadDataAsync([{ eventId, resourceId }]);
// assignmentStore.first.event is available
autoCommitStoreCRUD
changesStoreCRUD
countStore
firstStore
hasChangesStoreCRUD
lastStore
recordsStore

Advanced

isChainedStoreChained
StopBranchstaticStoreTree

CRUD

createUrlAjaxStore
deleteUrlAjaxStore
isCommittingAjaxStore
isLoadingAjaxStore
readUrlAjaxStore
updateUrlAjaxStore

Filtering

Lifecycle

configBase

Misc

Models & Stores

assignmentStorePartOfProject
dependencyStorePartOfProject
eventStorePartOfProject
projectPartOfProject
resourceStorePartOfProject

Other

currentPageStorePaging
jsonStore
lazyLoadAjaxStore
storesstaticStore

Paging

isPagedStorePaging
lastPageStorePaging
pageSizeStorePaging

Remote

paramsAjaxStore

Sort, group & filter

filtersStoreFilter
groupersStoreGroup
isFilteredStoreFilter
isGroupedStoreGroup
isSortedStoreSort
sortersStoreSort

Tree

isTreeStoreTree
leavesStoreTree

Functions

115

Assign

Creates and adds assignment record(s) for a given event and resource(s).

ParameterTypeDescription
eventTimeSpan
resourcesResourceModel | ResourceModel[]

The resource(s) to assign to the event

assignmentSetupFnfunction

A hook function which takes an assignment as its argument and must return an assignment.

removeExistingAssignmentsBoolean

true to remove assignments for other resources

Returns: AssignmentModel[] -

An array with the created assignment(s)

Removes assignment record for a given event and resource.

ParameterTypeDescription
eventTimeSpan | String | Number
resourcesResourceModel | String | Number

The resource to unassign the event from. If omitted, all resources of the events will be unassigned

Assignments

Returns an assignment record for a given event and resource

ParameterTypeDescription
eventEventModel | String | Number

The event or its id

resourceResourceModel | String | Number

The resource or its id

Returns all assignments for a given event.

ParameterTypeDescription
eventEventModel

The event to get assignments for

Returns: AssignmentModel[] -

Array of assignments for the event

Returns all assignments for a given resource.

ParameterTypeDescription
resourceResourceModel
Returns: AssignmentModel[]

Returns all events assigned to a resource

ParameterTypeDescription
resourceResourceModel | String | Number
Returns: TimeSpan[]

Returns all resources assigned to an event.

ParameterTypeDescription
eventEventModel
Returns: ResourceModel[]

Checks whether an event is assigned to a resource.

ParameterTypeDescription
eventEventModel | String | Number

Event record or id

resourceResourceModel | String | Number

Resource record or id

Returns: Boolean

Maps over event assignments.

ParameterTypeDescription
eventEventModel
fnfunction
filterFnfunction
Returns: EventModel[] | Array

Maps over resource assignments.

ParameterTypeDescription
resourceResourceModel | Number | String
fnfunction
filterFnfunction
Returns: ResourceModel[] | Array

Removes all assignments for given event

ParameterTypeDescription
eventTimeSpan

Removes all assignments for given resource

ParameterTypeDescription
resourceResourceModel | *

CRUD

Add assignments to the store.

NOTE: References (event, resource) on the assignments are determined async by a calculation engine. Thus they cannot be directly accessed after using this function.

For example:

const [assignment] = assignmentStore.add({ eventId, resourceId });
// assignment.event is not yet available

To guarantee references are set up, wait for calculations for finish:

const [assignment] = assignmentStore.add({ eventId, resourceId });
await assignmentStore.project.commitAsync();
// assignment.event is available (assuming EventStore is loaded and so on)

Alternatively use addAsync() instead:

const [assignment] = await assignmentStore.addAsync({ eventId, resourceId });
// assignment.event is available (assuming EventStore is loaded and so on)
ParameterTypeDescription
recordsAssignmentModel | AssignmentModel[] | AssignmentModelConfig | AssignmentModelConfig[]

Array of records/data or a single record/data to add to store

silentBoolean

Specify true to suppress events

Returns: AssignmentModel[] -

Added records

Add assignments to the store and triggers calculations directly after. Await this function to have up to date references on the added assignments.

const [assignment] = await assignmentStore.addAsync({ eventId, resourceId });
// assignment.event is available (assuming EventStore is loaded and so on)
ParameterTypeDescription
recordsAssignmentModel | AssignmentModel[] | AssignmentModelConfig | AssignmentModelConfig[]

Array of records/data or a single record/data to add to store

silentBoolean

Specify true to suppress events

Returns: AssignmentModel[] -

Added records

Applies a new dataset to the AssignmentStore and triggers calculations directly after. Use it to plug externally fetched data into the store.

await assignmentStore.loadDataAsync([{ eventId, resourceId }]);
// assignmentStore.first.event is available
ParameterTypeDescription
dataAssignmentModelConfig[]

Array of AssignmentModel data objects

applyChangesetStoreChanges
commitAjaxStore
insertStoreCRUD
loadAjaxStore
loadChildrenAjaxStore
loadPageAjaxStore
moveStoreCRUD
nextPageStorePaging
previousPageStorePaging
removeStoreCRUD
removeAllStoreCRUD
revertChangesStoreCRUD

Chained store

chainStoreChained
chainTreeStoreChained
fillFromMasterStoreChained

Configuration

applyDefaultsstaticBase

Events

Iteration

everyStore
flatMapStore
forEachStore
mapStore
reduceStore

Lifecycle

destroystaticBase

Misc

initClassstaticBase
isOfTypeNamestaticBase
mixinstaticBase

Other

getStorestaticStore
onEvents
relayAllEvents
toJSONStore
triggerEvents
unEvents

Records

getAtStore
getByIdStore
indexOfStore

Search

findStoreSearch
findByFieldStoreSearch
findRecordStoreSearch
queryStoreSearch
searchStoreSearch
someStoreSearch

Sort, group & filter

addFilterStoreFilter
addSorterStoreSort
clearFiltersStoreFilter
clearGroupersStoreGroup
clearSortersStoreSort
filterStoreFilter
filterByStoreFilter
getGroupRecordsStoreGroup
getGroupTitlesStoreGroup
groupStoreGroup
isRecordInGroupStoreGroup
removeFilterStoreFilter
removeSorterStoreSort
setGroupersStoreGroup
sortStoreSort

Sum

averageStoreSum
groupSumStoreSum
maxStoreSum
minStoreSum
sumStoreSum

Traverse

getNextStore
getPrevStore

Tree

getChildrenStoreTree
indentStoreTree
outdentStoreTree

Values

Events

45
addStoreCRUD
beforeAddStoreCRUD
beforeCommitStoreCRUD
beforeFilterStoreFilter
beforeIndentStoreTree
beforeLoadAjaxStore
beforeLoadPageStorePaging
beforeOutdentStoreTree
beforeRemoveStoreCRUD
beforeSortStoreSort
catchAllEvents
changeStore
commitStoreCRUD
commitAddedAjaxStore
commitRemovedAjaxStore
destroyEvents
exceptionAjaxStore
filterStoreFilter
groupStoreGroup
indentStoreTree
loadAjaxStore
loadChildrenAjaxStore
loadPageStorePaging
loadPageStartAjaxStore
loadStartAjaxStore
moveStore
outdentStoreTree
refreshStore
removeStoreCRUD
removeAllStoreCRUD
sortStoreSort
updateStore

Event handlers

45
onAddStoreCRUD
onBeforeAddStoreCRUD
onBeforeFilterStoreFilter
onBeforeLoadAjaxStore
onBeforeLoadPageStorePaging
onBeforeSortStoreSort
onCommitStoreCRUD
onCommitAddedAjaxStore
onDestroyEvents
onExceptionAjaxStore
onFilterStoreFilter
onGroupStoreGroup
onIndentStoreTree
onLoadAjaxStore
onLoadPageStorePaging
onLoadStartAjaxStore
onMoveStore
onOutdentStoreTree
onRemoveStoreCRUD
onRemoveAllStoreCRUD
onSortStoreSort

Typedefs

9