Move row with children by dragging by left mouse button, copy row by dragging by right mouse button and copy row with children by dragging by ctrl+right mouse button. You can copy row with or without its children or add new row above the row by clicking to button on row panel or on toolbar.
You can add new child to focused row by clicking button on toolbar. You can outdent or indent focused row by clicking buttons and on toolbar. It works the same as dragging the row to given position. You can copy focused row or selected rows to clipboard by ctrl+c. You can paste the row(s) in clipboard to selected rows or, if no row is selected, to new row(s) before focused row by ctrl+v. Select more rows (by panel button) or by space key or by dragging by ctrl+left mouse button and drag or copy them together.
Dragging permissions
By default all rows can be dragged. Set <I
CanDrag
='0'/> to suppress row dragging (it suppresses both moving and copying by dragging).
By default all rows can be copied. Set <I CanCopy='0'/> to suppress row copying (by dragging and by panel/toolbar buttons).
For whole grid suppress dragging all rows by <Cfg Dragging='0' />, suppress copying all rows by <Cfg Copying='0'/>
Dragging permissions can be also controlled dynamically and more precisely by API event
OnStartDrag
, e.g. to suppress only particular row moving and not copying.
Dropping permissions
are controlled by attributes Def and AcceptDef.
Def
is default row. It has more features, from the default row are read all attributes and values not set directly in the row. Every row can have only one default row, but default row can have also its default row to inherit its values from it.
AcceptDef
specifies which rows can be dropped or copied to this row as children. Only row its Def attribute value is listed in the target row AcceptDef can be dropped or copied to row.
There is also related attribute CDef for adding new child rows. When added new child to the row, it will have its Def attribute set to parent CDef value. Setting CDef to empty restricts adding new children to the row.
Dropping permissions can be also controlled dynamically by API event
OnCanDrop
.
For whole grid suppress dropping all rows by <Cfg Dropping='0' /> - it has sense for coping from another grid.
Changing Def
Def attribute of the target row can be automatically changed in case the row without children gets its first child (Def is set to DefParent value) and when the row with children loses its last child (Def is set to DefEmpty value).
Def attribute can be changed also dynamically by API method ChangeDef in OnEndDrag API event.
When the Def is changed, there is called OnChangeDef API event. Here you can do any custom action, e.g. change the def or mark the row changed to upload the changed Def to server.
Dragging actions
There are various dragging action to differ if row will be moved, copied or copied with its children. And if the row will be moved/copied single or all selected rows will be processed.
The actions are DragRow, DragCopy, DragCopyChildren, DragSelected, DragSelectedCopy, DragSelectedCopyChildren.
These actions can be attached to mouse dragging events differ by mouse button and key prefix, like OnDragRow, OnRightDragRow, OnCtrlDragRow, OnCtrlRightDragRow and so on.
Moving row(s) is possible also by dragging Move button to row panel. The button can be shown by <Panel Move='1'/>. These events can be similarly to set to the dragging actions, e.g. OnDragPanelMove or OnRightDragPanelMove.
There are also special actions to increase and decrease the row level Indent and Outdent. They work the same as the row is dragged.
The actions are assigned to events in <Actions/> tag. Default actions are assigned in file Grid/Defaults.xml.
Copying actions
For copy row(s) by dragging see previous paragraph.
There are many actions for copying actual, focused or selected rows, see their list in documentation Copying existing rows.
The Add... and Copy... actions are attached to the Add and AddChild toolbar buttons.
And also to Panel Copy button that can be shown by <Panel Copy='1'/>.
There are various API events called for dragging. In OnEndDrag do custom action on drop. In OnRowMove do the custom action after the row is moved.
Rows can be moved also by API method MoveRow. Other API methods and events are listed in documentation Row moving and dragging.
Save changes to server
Moved rows are marked by
Moved
attribute, Moved='1' means moved inside its parent and Moved='2' moved to new parent.
Moved='1' is used only when sorting is disabled (Sorting='0').
Copied and added rows are marked by
Added
attribute. The copied row contains no information about the source row. Only in server child paging, copied row with not yet loaded children gets attribute Copy as id of the source row.
The Moved and Added attributes are set in upload data, in the <Changes> tag. It is set also to the row and can be read by API. It is cleared after successful save.
See XML structure sent to server documentation
Moved row in upload data has set also attributes Parent, Next and Prev as ids of these rows to identify the new position of the row.
Parent is empty for root row.
If set <Cfg FullId='1'/>, the row id contains also parent row id to identify the row position in tree by the id.
When the row is moved to another parent, the id is updated after the change is successfully saved to server.
You can set <bdo Upload_Flags='NewId'> to upload the new id to server in NewId attribute.
See Row id in tree