Interface HasRecordDropHandlers
- All Superinterfaces:
HasHandlers
- All Known Implementing Classes:
CalendarView
,CubeGrid
,DateGrid
,EditTree
,ListGrid
,ListPalette
,Menu
,MenuPalette
,PickListMenu
,RecordEditor
,SelectionTreeMenu
,TableView
,TreeGrid
,TreePalette
-
Method Summary
Modifier and TypeMethodDescriptionaddRecordDropHandler
(RecordDropHandler handler) Process a drop of one or more records on a ListGrid record.Methods inherited from interface com.google.gwt.event.shared.HasHandlers
fireEvent
-
Method Details
-
addRecordDropHandler
Process a drop of one or more records on a ListGrid record.This method can be overridden to provide custom drop behaviors, and is a more appropriate override point than the lower level
Canvas.drop()
handler.If this is a self-drop, records are simply reordered.
For a drop from another widget,
transferDragData()
is called, which depending on thedragDataAction
specified on the source widget, may either remove the source records from the original list (dragDataAction:"move"
) or just provide a copy to this list (dragDataAction:"copy"
).If this grid is databound, the new records will be added to the dataset by calling
DataSource.addData()
. Further, if the new records were dragged from another databound component, andaddDropValues
is true,getDropValues
will be called for every item being dropped.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).
Note that reordering records has no effect on a databound grid.
The newly dropped data is then selected automatically.
If these default persistence behaviors are undesirable, Call
RecordDropEvent.cancel()
from withinRecordDropHandler.onRecordDrop(com.smartgwt.client.widgets.grid.events.RecordDropEvent)
to cancel them, then and 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().NOTE: for a drop beyond the last visible record of a ListGrid,
targetRecord
will be null and theindex
will be one higher than the last record. This includes a drop into an empty ListGrid, whereindex
will be 0.- Parameters:
handler
- the recordDrop handler- Returns:
HandlerRegistration
used to remove this handler
-