Type class
A version of a List
that has a "template".
A template is an instance of an object, that can be used to create new elements in the list without actually needing to create instances for those.
When new element is created in the list, e.g. by calling its create()
method, an exact copy of the element is created (including properties and other attributes), inserted into the list and returned.
Sources
ListTemplate can be used (imported) via one of the following packages.
/** * -------------------------------------------------------- * Import from: "core.ts" * Use like: am4core.ListTemplate * -------------------------------------------------------- */ import * as am4core from "@amcharts/amcharts4/core";
/** * -------------------------------------------------------- * Include via: <script src="core.js"></script> * Access items like: am4.ListTemplate * -------------------------------------------------------- */
Inheritance
ListTemplate extends List
.
ListTemplate is not extended by any other symbol.
Properties
events # |
Type Default Inherited from Event dispatcher. |
---|---|
length # |
Type Inherited from Number of items in list. @readonly |
template # |
Type A "template" object to copy all properties from when creating new list items. |
values # |
Type Inherited from An array of values in the list. Do not use this property to add values. Rather use dedicated methods, like @readonly |
There are 3 inherited items currently hidden from this list. |
Methods
[Symbol.iterator]() |
Returns Inherited from Returns an ES6 iterator for the list. |
---|---|
clear() |
Returns Inherited from Removes all items from the list. |
clone() |
Returns Creates an exact clone of the list, including its items and template. |
constructor( t: ) |
Returns Constructor |
contains( value: ) |
Returns Inherited from Checks if list contains specific item reference. |
copyFrom( source: ) |
Returns Copies all elements from other list. |
create( make: { } ) |
Returns Instantiates a new object of the specified type, adds it to the end of the list, and returns it. |
each( f: ( value: ) |
Returns Inherited from Calls |
getIndex( index: ) |
Returns Inherited from Returns an item at specified index. |
hasIndex( index: ) |
Returns Inherited from Checks if there's a value at specific index. |
indexOf( value: ) |
Returns Inherited from Searches the list for specific item and returns its index. |
insertIndex( index: ) |
Returns Inherited from Adds an item to the list at a specific index, which pushes all the other items further down the list. |
iterator() |
Returns Inherited from Returns a list iterator. |
moveValue( value: ) |
Returns Inherited from Moves an item to a specific index within the list. If the index is not specified it will move the item to the end of the list. |
pop() |
Returns Inherited from Returns the last item from the list, and removes it. |
push( value: ) |
Returns Inherited from Adds an item to the end of the list. |
pushAll( values: ) |
Returns Inherited from Adds multiple items to the list. |
removeIndex( index: ) |
Returns Inherited from Removes a value at specific index. |
removeValue( value: ) |
Returns Inherited from Removes specific item from the list. |
setAll( newArray: ) |
Returns Inherited from Sets multiple items to the list. All current items are removed. |
setIndex( index: ) |
Returns Inherited from Sets value at specific index. If there's already a value at the index, it is overwritten. |
shift() |
Returns Inherited from Returns the first item from the list, and removes it. |
sort( order: ( left: ) |
Returns Inherited from Reorders list items according to specific ordering function. |
swap( a: ) |
Returns Inherited from Swaps indexes of two items in the list. |
unshift( value: ) |
Returns Inherited from Adds an item as a first item in the list. |
There are 21 inherited items currently hidden from this list. |
Events
#insertIndex |
Param { index: Inherited from Invoked when |
---|---|
#inserted |
Param { newValue: Inherited from Invoked when item is added to the list. @todo remove this later? |
#removeIndex |
Param { index: Inherited from Invoked when item is removed. |
#removed |
Param { oldValue: Inherited from Invoked when item is removed from the list. @todo remove this later? |
#setAll |
Param { newArray: Inherited from Invoked when |
#setIndex |
Param { index: Inherited from Invoked when |
There are 6 inherited items currently hidden from this list. |
Adapters
ListTemplate does not have any adapters.