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

VirtualArray

Generic types:P C

Class that represents an array that is not fully loaded from the server but loads the data as it is needed.

Constructor

The constructor of the virtual array that takes the length of the array as a parameter.

Presentation
constructor(
	array: VirtualArrayContents, 
	private parentActionService: ActionService, 
	parentId: string, 
	childField: string
): VirtualArray<P, C>;
Parameters
NameTypeDescription
array
VirtualArrayContents

array that contains the available IDs

parentActionService
ActionService

the action service of the parent row

parentId
string

the id of the parent row

childField
string

the fieldName in the parent row that holds the children for this array

Properties

NameTypeDescription
fetchedIndexes
boolean[]
length
number
rawArray
string[]

Methods

getIdAtIndex()

returns the id at the given index without fetching the id from the server. if the id does not exist, an ID based on the index is returned.

Presentation
getIdAtIndex(index: number): string | undefined;
Parameters
NameTypeDescription
index
number

the index to get the id at

Returns
string | undefined -

the id at the given index

refetchIndexes()

Tells the virtual array to refetch the indexes the next time an element is requested.

Presentation
refetchIndexes(): void;
Returns
void