Action Service is what we call to dispatch actions and do whatever logic is needed prior to the dispatch. This reduces the number of actions we need to create, makes the code easier to read, centralizes the access to the store, and keeps logic out of the reducer and effects without scattering the logic throughout the application.
Constructor
constructor for the ActionService
Presentation Parameters Name Type Description feature
string
the name of the feature this class is for
entity
string
the name of the entity this class is for
Properties
Name Type Description entities
Observable<Dictionary<SmartNgRXRowBase >>
entityAdapter
EntityAdapter<SmartNgRXRowBase >
entityAdapter is needed for delete so it is public
Methods
add()
adds a row to the store
Presentation Parameters Name Type Description row
SmartNgRXRowBase
the row to add
parentId
string
the id of the parent row
parentService
ActionService
the service for the parent row
Returns void
delete()
Deletes the row represented by the Id from the store
Presentation delete ( id : string ) : void ;
Parameters Name Type Description id
string
the id of the row to delete
Returns void
forceDirty()
this forces the row to be marked as dirty regardless of any other conditions. Primarily used for websockets
Presentation forceDirty (ids: string[]): void ;
Parameters Name Type Description ids
string[]
the ids to mark as dirty
Returns void
garbageCollect()
Rows that can be removed are unregisterd from the garbage collection and then removed from the store if they are not being edited.
Presentation garbageCollect (ids: string[]): void ;
Parameters Name Type Description ids
string[]
the ids to remove
Returns void
init()
Tries to initialize the ActionService.
Presentation Returns boolean
- true if successful, false if not
loadByIds()
Calls the loadByIds action to load the rows into the store.
Presentation loadByIds (ids: string[]): void ;
Parameters Name Type Description ids
string[]
the ids to load
Returns void
loadByIdsPreload()
adds dummy rows to the store for ones we are retrieving
Presentation loadByIdsPreload (ids: string[]): void ;
Parameters Name Type Description ids
string[]
the ids we are retrieving
Returns void
loadByIdsSuccess()
puts the rows in the store
Presentation Parameters Returns void
loadByIndexes()
que up loading the ids for the indexes
Presentation loadByIndexes (parentId: string , childField: string , indexes: number[]): void ;
Parameters Name Type Description parentId
string
the id of the parent row
childField
string
the child field to load
indexes
number[]
the indexes to load
Returns void
loadByIndexesSuccess()
This updates the childField with the ids provided so we can use them in the VirtualArray. Make sure when you call this you are calling the service for the parent entity and not the child entity.
Presentation Parameters Name Type Description parentId
string
the id of the parent row so we can update the proper childField
childField
string
the child field to update
array
PartialArrayDefinition
specifiers that define the new partial array
Returns void
markDirty()
marks the rows as dirty and takes into account settings indicating if this should cause a refresh or not
Presentation markDirty (ids: string[]): void ;
Parameters Name Type Description ids
string[]
the ids to mark as dirty
Returns void
markNotDirty()
marks the rows represented by the ids as not dirty
Presentation markNotDirty (ids: string[]): void ;
Parameters Name Type Description ids
string[]
the ids to mark as not dirty
Returns void
remove()
removes the rows represented by ids from the store unconditionally
Presentation remove (ids: string[]): void ;
Parameters Name Type Description ids
string[]
the ids of the rows to remove from the store
Returns void
removeFromParents()
removes the id from the child arrays of the parent rows
Presentation Parameters Name Type Description id
string
the id to remove
Returns
replaceIdInParents()
replaces the id in the parent rows with the new id this is used when we commit a new row to the server
Presentation Parameters Name Type Description id
string
the id to replace
newId
string
the new id to replace the old id with
Returns void
update()
updates the row in the store
Presentation Parameters Returns void
updateMany()
updates many rows in the store
Presentation Parameters Returns void