DHTMLX Docs & Samples Explorer

Setting Drag Behavior

Drag-And-Drop behavior for TreeGrid can be set in the following way:

        treegrid.setDragBehavior(mode);

It is possible to select one of the following modes:

  • child - the item is dropped as a child of the target item;
  • sibling - the item is dropped as a sibling of the target item; if drop occurs between the parent and the child elements, the item is moved on the parent level;
  • complex - the item is dropped as a sibling or a child depending on the position of the target item towards the landing; if drop occurs between the parent and the child elements, the item is moved on the parent level;
  • sibling-next - the item is dropped as a sibling of the target; if drop occurs between the parent and the child elements, the item is moved on the child level;
  • complex-next - the item is dropped as a sibling or a child depending on the position of the target item towards the landing; if drop occurs between the parent and the child elements, the item is moved on the child level.