Skip to main content

copy()

creates a copy of an item at the defined position

copy(id: (string | number) | (string | number)[], index: number, target?: object): (string | number) | (string | number)[];

Parameters:

  • id: (string | number) | (string | number)[] - the id of an item or an array with ids of items to copy
  • index: number - the index to create a copy at
  • target: object - optional, the target data collection object

Returns:

The item's id or an array with ids of items.

Example

component.data.copy("4",5); // copies the item with id:4 to the position with index 5

Related sample: Data. Copy