Skip to main content

move()

Description

Moves an item to the defined position

Usage

move(
id: string | number | array,
index: number,
target?: object
): string | number | array;

Parameters

  • id - (required) the id(s) of an item(s) to move
  • index - (required) the index to move an item(s) to
  • target - (optional) the target data collection object

Returns

The method returns either a string with the item's id or an array of string values with ids of items

Example

const diagram = new dhx.Diagram("diagram_container", {
type: "default"
});
diagram.data.parse(data);

diagram.data.move("4",5); // moves the shape with id=4 to the position with index 5