Interface FolderDropHandler
- All Superinterfaces:
EventHandler
-
Method Summary
Modifier and TypeMethodDescriptionvoid
onFolderDrop
(FolderDropEvent event) Process a drop of one or more nodes on a TreeGrid folder.
Note: SeeTreeGridDrop
for an overview of TreeGrid drag and drop behavior.
-
Method Details
-
onFolderDrop
Process a drop of one or more nodes on a TreeGrid folder.
Note: SeeTreeGridDrop
for an overview of TreeGrid drag and drop behavior. Add logic in your drop handler to perform custom drop behaviors; to suppress the built-in behavior described below, useevent.cancel()
The default behavior is to simply delegate to the
transferNodes()
method; thus, the correct way to perform a programmatic folder drop, with all the built-in behaviors described below, is to calltransferNodes()
If this is a self-drop, nodes are simply reordered. An "update" operation will be submitted to update the
parentId
field of the moved node(s).For a drop from another widget,
transferDragData()
is called which, depending on thedragDataAction
specified on the source widget, may either remove the source nodes from the original list (dragDataAction:"move"
) or just provide a copy to this tree (dragDataAction:"copy"
).In either case the new row(s) appear in the
folder
at theindex
specified by the arguments of the same name.If this grid is databound, the new nodes will be added to the dataset by calling
DataSource.addData()
. Further, if the new nodes were dragged from another databound component, andaddDropValues
is true,getDropValues
will be called for every item being dropped.As a special case, if the
sourceWidget
is also databound and aforeignKey
relationship is declared from thesourceWidget
's DataSource to this TreeGrid's DataSource, the interaction will be treated as a "drag recategorization" use case such as files being placed in folders, employees being assigned to teams, etc. "update" DSRequests will be submitted that change the foreignKey field in the dropped records to point to the tree folder that was the target of the drop. In this case no change will be made to the Tree data as such, only to the dropped records.For multi-record drops, Queuing is automatically used to combine all DSRequests into a single HTTP Request (see QuickStart Guide, Server Framework chapter). This allows the server to persist all changes caused by the drop in a single transaction (and this is automatically done when using the built-in server DataSources with Power Edition and above).
If these default persistence behaviors are undesirable, use
event.cancel()
, then implement your own behavior, typically by using grid.updateData() or addData() to add new records.NOTE: the records you receive in this event are the actual Records from the source component. Use
DataSource.copyRecords()
to create a copy before modifying the records or using them with updateData() or addData().- Parameters:
event
- the event
-