Skip to main content

copy()

creates a copy of an item at the defined position

copy(id: Id | Id[], index: number, target?: IDataCollection): Id | Id[];

Parameters:

  • id: string | string[] - the id of an item 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