ListTemplate

Type class

A version of a List that is able to create new elements as well as apply additional settings to newly created items.

Click here for more info

Sources

ListTemplate can be used (imported) via one of the following packages.

// Import ListTemplate
import * as am5 from "@amcharts/amcharts5";

// Create ListTemplate
am5.ListTemplate.new(root, {
  // ... config if applicable
});
<!-- Load ListTemplate -->
<script src="index.js"></script>

<script>
// Create ListTemplate
am5.ListTemplate.new(root, {
  // ... config if applicable
});
</script>

Inheritance

ListTemplate extends ListAutoDispose.

ListTemplate is not extended by any other symbol.

Settings

ListTemplate does not have any settings.

Private settings

ListTemplate does not have any private settings.

Properties

autoDispose
#

Type boolean

Default true

Inherited from ListAutoDispose

Automatically disposes elements that are removed from the list.

events
#

Type EventDispatcher

Default new EventDispatcher()

Inherited from List

length
#

Type number

Inherited from List

Number of items in list.

@readonly

make
#

Type () => A

template
#

Type Template

values
#

Type Array

Inherited from List

An array of values in the list.

Do not use this property to add values. Rather use dedicated methods, like push(), removeIndex(), etc.

@readonly

There are 4 inherited items currently hidden from this list.

Methods

[Symbol.iterator]()

#

Returns Iterator

Inherited from List

Returns an ES6 iterator for the list.

clear()

#

Returns void

Inherited from List

Removes all items from the list.

constructor(

template: Template,
make: () => A

)

#

Returns ListTemplate

contains(

value: A

)

#

Returns boolean

Inherited from List

Checks if list contains specific item reference.

copyFrom(

source: this

)

#

Returns void

Inherited from List

Copies and adds items from abother list.

dispose()

#

Returns void

Inherited from ListAutoDispose

each(

f: ( value: A, index: number) => void

)

#

Returns void

Inherited from List

Calls f for each element in the list.

f should have at least one parameter defined which will get a current item, with optional second argument - index.

eachReverse(

f: ( value: A, index: number) => void

)

#

Returns void

Inherited from List

Calls f for each element in the list, from right to left.

f should have at least one parameter defined which will get a current item, with optional second argument - index.

getIndex(

index: number

)

#

Returns A | undefined

Inherited from List

Returns an item at specified index.

hasIndex(

index: number

)

#

Returns boolean

Inherited from List

Checks if there's a value at specific index.

indexOf(

value: A

)

#

Returns number

Inherited from List

Searches the list for specific item and returns its index.

insertIndex(

index: number,
value: K

)

#

Returns K

Inherited from List

Adds an item to the list at a specific index, which pushes all the other items further down the list.

isDisposed()

#

Returns boolean

Inherited from ListAutoDispose

moveValue(

value: K,
toIndex?: undefined | number

)

#

Returns K

Inherited from List

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 Optional

Inherited from List

Returns the last item from the list, and removes it.

push(

value: K

)

#

Returns K

Inherited from List

Adds an item to the end of the list.

pushAll(

values: Array

)

#

Returns void

Inherited from List

Adds multiple items to the list.

removeIndex(

index: number

)

#

Returns A

Inherited from List

Removes a value at specific index.

removeValue(

value: A

)

#

Returns void

Inherited from List

Removes specific item from the list.

setAll(

newArray: Array

)

#

Returns void

Inherited from List

Sets multiple items to the list.

All current items are removed.

setIndex(

index: number,
value: A

)

#

Returns A

Inherited from List

Sets value at specific index.

If there's already a value at the index, it is overwritten.

shift()

#

Returns Optional

Inherited from List

Returns the first item from the list, and removes it.

swap(

a: number,
b: number

)

#

Returns void

Inherited from List

Swaps indexes of two items in the list.

unshift(

value: K

)

#

Returns K

Inherited from List

Adds an item as a first item in the list.

There are 23 inherited items currently hidden from this list.

Events

Add event handlers to ListTemplate object using its events.on() method.

Read about adding event handlers.

#clear

Param { oldValues: Array,
  type: "clear",
  target: this }

Inherited from List

#insertIndex

Param { index: number,
  newValue: A,
  type: "insertIndex",
  target: this }

Inherited from List

#moveIndex

Param { newIndex: number,
  oldIndex: number,
  value: A,
  type: "moveIndex",
  target: this }

Inherited from List

#push

Param { newValue: A,
  type: "push",
  target: this }

Inherited from List

#removeIndex

Param { index: number,
  oldValue: A,
  type: "removeIndex",
  target: this }

Inherited from List

#setIndex

Param { index: number,
  newValue: A,
  oldValue: A,
  type: "setIndex",
  target: this }

Inherited from List

There are 6 inherited items currently hidden from this list.