Drag and Drop in the CTable
Use
You can move various elements in a CTable by using drag and drop. The aggregations of the CTable DRAG_SOURCE_INFOS (0..n) and DROP_TARGET_INFOS (0..n) are available for this purpose.
DRAG_SOURCE_INFOS
DRAG_SOURCE_INFOS are sources of elements that can be dragged. These sources are used for rows ( rowDragInfo in the CTable) and for columns ( columnDragInfo in the CTableColumn).
All rows have the same DragSourceInfo, whereas each column can have its own DragSourceInfo. In this case, the properties rowDragInfo and columnDragInfo contain the ID of a DragSourceInfo, which exists as an aggregation in the table.
rowDragInfo (0..1)
ID of DragSourceInfo, which specifies the source (the drag source) for a row. The DragSourceInfo must exist as an aggregation in the CTable.
columnDragInfo
ID of DragSourceInfo, which specifies the source (the drag source) for a column. The DropTargetInfo must exist as an aggregation in the CTable.
DROP_TARGET_INFOS
DROP_TARGET_INFOS are the rows on which elements can be dropped.
Drop Zones of a CTable
A CTable has various zones in which elements can be dropped:
-
Between columns:
DropTargetInfo: columnHeaderDropInfo (0..1)
-
On columns:
DropTargetInfo: columnDropInfo (0..1)
-
Before or after a column:
DropTargetInfo: columnEdgeDropInfo (0..1)
-
Between rows:
DropTargetInfo: tableBodyDropInfo (0..1)
-
On rows:
DropTargetInfo: rowDropInfo (0..n)
-
Before or after a row:
DropTargetInfo: rowEdgeDropInfo (0..n)
The following figure shows these drop zones and names the relevant DropTargetInfo:
The following properties are relevant for drag and drop in the CTable:
-
columnHeaderDropInfo (0..1)
This DropTargetInfo defines which elements can be dragged between all columns. The DropTargetInfo must exist as an aggregation in the CTable.
If columns define a separate columnEdgeDropInfo, this columnEdgeDropInfo overwrites the columnHeaderDropInfo of the respective column.
-
tableBodyDropInfo (0..1)
This DropTargetInfo defines which elements can be dropped between rows. The DropTargetInfo must exist as an aggregation in the CTable.
An exception applies if a row overwrites this property using rowEdgeDropInfo.
-
rowDropInfo (0..n)
This DropTargetInfo defines which elements can be dropped on rows. Using the context of the CTable, this enables you to use any DropTargetInfo for each row. The DropTargetInfo must exist as an aggregation in the CTable.
-
rowEdgeDropInfo (0..n)
This DropTargetInfo defines which elements can be dropped before or after a row. Using the context of the CTable, this enables you to decide for each row which elements can be dropped before and after it. The DropTargetInfo must exist as an aggregation in the CTable.
The event onDrop of the CTable is called if something is dropped between or on rows.
The following properties are relevant for drag and drop in the CTableColumn:
-
columnDropInfo (0..1)
This DropTargetInfo defines which elements can be dropped on a column. The DropTargetInfo must exist as an aggregation in the CTable.
-
columnEdgeDropInfo (0..1)
This DropTargetInfo defines which elements can be dropped before or after a column. The DropTargetInfo must exist as an aggregation in the CTable.
The event onDrop of the CTableColumn is called if an element is dropped between or on columns.
More Information
There is a test application for drag and drop in the CTable in the system under WDR_TEST_C_TABLE and WDR_TEST_DRAG_AND_DROP.
For more information about drag and drop, see here.