Home
Using Smart NgRX
Demo Walkthrough
API
@smarttools/smart-ngrx / Class

LoadByIndexes

This class is used to manage loading the child ids by their location in the array.

Constructor

The constructor for the LoadByIndexes class.

Presentation
constructor(
	private feature: string, 
	private entity: string, 
	private store: Store<object>
): LoadByIndexes;
Parameters
NameTypeDescription
feature
string

the name of the feature this class is for

entity
string

the name of the entity this class is for

store
Store<object>

the store to dispatch the actions to

Properties

NameTypeDescription
actions
ActionGroup<SmartNgRXRowBase>
entities
Observable<Dictionary<SmartNgRXRowBase>>

Methods

init()

Initializes the service with the actions and starts the dispatcher.

Presentation
init(actions: ActionGroup<SmartNgRXRowBase>, entities: Observable<Dictionary<SmartNgRXRowBase>>): void;
Parameters
NameTypeDescription
actions
ActionGroup<SmartNgRXRowBase>

the actions to use

entities
Observable<Dictionary<SmartNgRXRowBase>>

the entities to check for loading

Returns
void

loadByIndexes()

que up loading the ids for the indexes

Presentation
loadByIndexes(parentId: string, childField: string, indexes: number[]): void;
Parameters
NameTypeDescription
parentId
string

the id of the parent row

childField
string

the child field to load

indexes
number[]

the indexes to load

Returns
void

loadByIndexesDispatcher()

Dispatches the loadByIndexes action after buffering the indexes.

Presentation
loadByIndexesDispatcher(): void;
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
loadByIndexesSuccess(parentId: string, childField: string, array: PartialArrayDefinition): void;
Parameters
NameTypeDescription
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