Handling Drag and Drop
Handling Drag and Drop
You can easily set up your own drag and drop event listeners using
addDragDropListener()
and
addDragOverListener()
methods. By default, drag and drop listeners are disabled.
If the event listeners are enabled:
- any panel can be a drag target
- only the tree panel can serve as a drag source.
For standard panel types, the controller will auto-wire your drag and drop event listeners:
workRequestGrid_onDragOver(dragSource, data) {
return true; // OK to drop here
}
workRequestGrid_onDragDrop(dragSource, data) {
// if the "data" is a Work request record, add it to the grid
}
When you use drag and drop listeners as shown above, the complete area of the panel is registered as a drop target. You can implement a more fine-grained drop strategy by registering individual DOM elements as drop targets using Ext.JS drag and drop API.
The grid panel drag operation carries a reference to
Ab.grid.Row
object as a "
data
" parameter.
You can enable drag individually for any tree panel level:
this.workRequestGrid.enableDragForLevel(0);
The tree panel drag operation carries a reference to
Ab.tree.TreeNode
object as a "
data
" parameter.