class sap.ui.core.dnd.DropInfo

Control sample: sap.ui.core.dnd.DropInfo
Visiblity: public
UX Guidelines:
Implements: sap.ui.core.dnd.IDropInfo
Available since: N/A
Module: sap/ui/core/dnd/DropInfo
Application Component: CA-UI5-TBL

Provides the configuration for drop operations. Note: This configuration might be ignored due to control metadata restrictions.


Constructor

Constructor for a new DropInfo.

Accepts an object literal mSettings that defines initial property values, aggregated and associated objects as well as event handlers. See sap.ui.base.ManagedObject#constructor for a general description of the syntax of the settings object.

new sap.ui.core.dnd.DropInfo(sId?, mSettings?)
Param Type Default Value Description
sId? string

ID for the new DropInfo, generated automatically if no ID is given

mSettings? object

Initial settings for the DropInfo


Properties

Name Type Default Value Description
dropEffect sap.ui.core.dnd.DropEffect Move

Defines the visual drop effect.

Visibility: public
dropLayout sap.ui.core.dnd.DropLayout Default

Defines the layout of the droppable controls if dropPosition is set to Between or OnOrBetween.

Visibility: public
dropPosition sap.ui.core.dnd.DropPosition On

Defines the position for the drop action, visualized by a rectangle.

Visibility: public
targetAggregation string

The aggregation name in the drop target control which is the target of this drag-and-drop action. If undefined, the entire control is the target. This can be handy if the target control does not have any aggregations or if the drop position within the target does not matter.

Visibility: public

Borrowed Properties

Name Type Default Value Description
enabled boolean true

Indicates whether this configuration is active or not.

Since: 1.56.

Visibility: public
groupName string

Defines the name of the group to which this object belongs. If groupName is specified, then this object will only interacts with other drag-and-drop objects within the same group.

Visibility: public

Borrowed Aggregations

Name Cardinality Type Description
customData 0..n sap.ui.core.CustomData

Custom Data, a data structure like a map containing arbitrary key value pairs.

dependents 0..n sap.ui.core.Element

Dependents are not rendered, but their databinding context and lifecycle are bound to the aggregating Element.

Since: 1.19.

dragDropConfig 0..n sap.ui.core.dnd.DragDropBase

Defines the drag-and-drop configuration. Note: This configuration might be ignored due to control metadata restrictions.

Since: 1.56.

layoutData 0..1 sap.ui.core.LayoutData

Defines the layout constraints for this control when it is used inside a Layout. LayoutData classes are typed classes and must match the embedding Layout. See VariantLayoutData for aggregating multiple alternative LayoutData instances to a single Element.

tooltip 0..1 sap.ui.core.TooltipBase

The tooltip that should be shown for this Element.

In the most simple case, a tooltip is a string that will be rendered by the control and displayed by the browser when the mouse pointer hovers over the control's DOM. In this variant, tooltip behaves like a simple control property.

Controls need to explicitly support this kind of tooltip as they have to render it, but most controls do. Exceptions will be documented for the corresponding controls (e.g. sap.ui.core.HTML does not support tooltips).

Alternatively, tooltip can act like a 0..1 aggregation and can be set to a tooltip control (an instance of a subclass of sap.ui.core.TooltipBase). In that case, the framework will take care of rendering the tooltip control in a popup-like manner. Such a tooltip control can display arbitrary content, not only a string.

UI5 currently does not provide a recommended implementation of TooltipBase as the use of content-rich tooltips is discouraged by the Fiori Design Guidelines. Existing subclasses of TooltipBase therefore have been deprecated. However, apps can still subclass from TooltipBase and create their own implementation when needed (potentially taking the deprecated implementations as a starting point).

See the section Using Tooltips in the Fiori Design Guideline.


Events Overview

Event Description
dragEnter

This event is fired when a dragged element enters a drop target.

dragOver

This event is fired when an element is being dragged over a valid drop target.

Since: 1.56.

drop

This event is fired when an element is dropped on a valid drop target, as specified by the drag-and-drop info.

dragEnter

This event is fired when a dragged element enters a drop target.

Param Type Description
oControlEvent sap.ui.base.Event
getSource sap.ui.base.EventProvider
getParameters object
target sap.ui.core.Element

The target element on which the dragged element will be dropped

dragSession sap.ui.core.dnd.DragSession

The UI5 dragSession object that exists only during drag and drop

browserEvent Event

The underlying browser event

dragOver

This event is fired when an element is being dragged over a valid drop target.

Since: 1.56.

Param Type Description
oControlEvent sap.ui.base.Event
getSource sap.ui.base.EventProvider
getParameters object
target sap.ui.core.Element

The target element on which the dragged element will be dropped

dragSession sap.ui.core.dnd.DragSession

The UI5 dragSession object that exists only during drag and drop

dropPosition string

The calculated position of the drop action relative to the target, possible values are Before, On, After

browserEvent Event

The underlying browser event

drop

This event is fired when an element is dropped on a valid drop target, as specified by the drag-and-drop info.

Param Type Description
oControlEvent sap.ui.base.Event
getSource sap.ui.base.EventProvider
getParameters object
dragSession sap.ui.core.dnd.DragSession

The UI5 dragSession object that exists only during drag and drop

draggedControl sap.ui.core.Element

The element being dragged

droppedControl sap.ui.core.Element

The element being dropped

dropPosition string

The calculated position of the drop action relative to the droppedControl, possible values are Before, On, After

browserEvent Event

The underlying browser event


Methods Overview

Method Description
attachDragEnter

Attaches event handler fnFunction to the dragEnter event of this sap.ui.core.dnd.DropInfo.

When called, the context of the event handler (its this) will be bound to oListener if specified, otherwise it will be bound to this sap.ui.core.dnd.DropInfo itself.

This event is fired when a dragged element enters a drop target.

attachDragOver

Attaches event handler fnFunction to the dragOver event of this sap.ui.core.dnd.DropInfo.

When called, the context of the event handler (its this) will be bound to oListener if specified, otherwise it will be bound to this sap.ui.core.dnd.DropInfo itself.

This event is fired when an element is being dragged over a valid drop target.

attachDrop

Attaches event handler fnFunction to the drop event of this sap.ui.core.dnd.DropInfo.

When called, the context of the event handler (its this) will be bound to oListener if specified, otherwise it will be bound to this sap.ui.core.dnd.DropInfo itself.

This event is fired when an element is dropped on a valid drop target, as specified by the drag-and-drop info.

detachDragEnter

Detaches event handler fnFunction from the dragEnter event of this sap.ui.core.dnd.DropInfo.

The passed function and listener object must match the ones used for event registration.

detachDragOver

Detaches event handler fnFunction from the dragOver event of this sap.ui.core.dnd.DropInfo.

The passed function and listener object must match the ones used for event registration.

detachDrop

Detaches event handler fnFunction from the drop event of this sap.ui.core.dnd.DropInfo.

The passed function and listener object must match the ones used for event registration.

sap.ui.core.dnd.DropInfo.extend

Creates a new subclass of class sap.ui.core.dnd.DropInfo with name sClassName and enriches it with the information contained in oClassInfo.

oClassInfo might contain the same kind of information as described in sap.ui.core.dnd.DragDropBase.extend.

fireDragEnter

Fires event dragEnter to attached listeners.

Listeners may prevent the default action of this event by calling the preventDefault method on the event object. The return value of this method indicates whether the default action should be executed.

fireDragOver

Fires event dragOver to attached listeners.

fireDrop

Fires event drop to attached listeners.

getDropEffect

Gets current value of property dropEffect.

Defines the visual drop effect.

Default value is "Move".

getDropLayout

Gets current value of property dropLayout.

Defines the layout of the droppable controls if dropPosition is set to Between or OnOrBetween.

Default value is "Default".

getDropPosition

Gets current value of property dropPosition.

Defines the position for the drop action, visualized by a rectangle.

Default value is "On".

sap.ui.core.dnd.DropInfo.getMetadata

Returns a metadata object for class sap.ui.core.dnd.DropInfo.

getTargetAggregation

Gets current value of property targetAggregation.

The aggregation name in the drop target control which is the target of this drag-and-drop action. If undefined, the entire control is the target. This can be handy if the target control does not have any aggregations or if the drop position within the target does not matter.

setDropEffect

Sets a new value for property dropEffect.

Defines the visual drop effect.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is "Move".

setDropLayout

Sets a new value for property dropLayout.

Defines the layout of the droppable controls if dropPosition is set to Between or OnOrBetween.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is "Default".

setDropPosition

Sets a new value for property dropPosition.

Defines the position for the drop action, visualized by a rectangle.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is "On".

setTargetAggregation

Sets a new value for property targetAggregation.

The aggregation name in the drop target control which is the target of this drag-and-drop action. If undefined, the entire control is the target. This can be handy if the target control does not have any aggregations or if the drop position within the target does not matter.

When called with a value of null or undefined, the default value of the property will be restored.

attachDragEnter

Attaches event handler fnFunction to the dragEnter event of this sap.ui.core.dnd.DropInfo.

When called, the context of the event handler (its this) will be bound to oListener if specified, otherwise it will be bound to this sap.ui.core.dnd.DropInfo itself.

This event is fired when a dragged element enters a drop target.

Param Type DefaultValue Description
oData object

An application-specific payload object that will be passed to the event handler along with the event object when firing the event

fnFunction function(sap.ui.base.Event) : void

The function to be called when the event occurs

oListener object

Context object to call the event handler with. Defaults to this sap.ui.core.dnd.DropInfo itself

attachDragOver

Attaches event handler fnFunction to the dragOver event of this sap.ui.core.dnd.DropInfo.

When called, the context of the event handler (its this) will be bound to oListener if specified, otherwise it will be bound to this sap.ui.core.dnd.DropInfo itself.

This event is fired when an element is being dragged over a valid drop target.

Param Type DefaultValue Description
oData object

An application-specific payload object that will be passed to the event handler along with the event object when firing the event

fnFunction function(sap.ui.base.Event) : void

The function to be called when the event occurs

oListener object

Context object to call the event handler with. Defaults to this sap.ui.core.dnd.DropInfo itself

attachDrop

Attaches event handler fnFunction to the drop event of this sap.ui.core.dnd.DropInfo.

When called, the context of the event handler (its this) will be bound to oListener if specified, otherwise it will be bound to this sap.ui.core.dnd.DropInfo itself.

This event is fired when an element is dropped on a valid drop target, as specified by the drag-and-drop info.

Param Type DefaultValue Description
oData object

An application-specific payload object that will be passed to the event handler along with the event object when firing the event

fnFunction function(sap.ui.base.Event) : void

The function to be called when the event occurs

oListener object

Context object to call the event handler with. Defaults to this sap.ui.core.dnd.DropInfo itself

detachDragEnter

Detaches event handler fnFunction from the dragEnter event of this sap.ui.core.dnd.DropInfo.

The passed function and listener object must match the ones used for event registration.

Param Type DefaultValue Description
fnFunction function(sap.ui.base.Event) : void

The function to be called, when the event occurs

oListener object

Context object on which the given function had to be called

detachDragOver

Detaches event handler fnFunction from the dragOver event of this sap.ui.core.dnd.DropInfo.

The passed function and listener object must match the ones used for event registration.

Param Type DefaultValue Description
fnFunction function(sap.ui.base.Event) : void

The function to be called, when the event occurs

oListener object

Context object on which the given function had to be called

detachDrop

Detaches event handler fnFunction from the drop event of this sap.ui.core.dnd.DropInfo.

The passed function and listener object must match the ones used for event registration.

Param Type DefaultValue Description
fnFunction function(sap.ui.base.Event) : void

The function to be called, when the event occurs

oListener object

Context object on which the given function had to be called

sap.ui.core.dnd.DropInfo.extend

Creates a new subclass of class sap.ui.core.dnd.DropInfo with name sClassName and enriches it with the information contained in oClassInfo.

oClassInfo might contain the same kind of information as described in sap.ui.core.dnd.DragDropBase.extend.

Param Type DefaultValue Description
sClassName string

Name of the class being created

oClassInfo object

Object literal with information about the class

FNMetaImpl function

Constructor function for the metadata object; if not given, it defaults to the metadata implementation used by this class

fireDragEnter

Fires event dragEnter to attached listeners.

Listeners may prevent the default action of this event by calling the preventDefault method on the event object. The return value of this method indicates whether the default action should be executed.

Param Type DefaultValue Description
mParameters object

Parameters to pass along with the event

fireDragOver

Fires event dragOver to attached listeners.

Param Type DefaultValue Description
mParameters object

Parameters to pass along with the event

fireDrop

Fires event drop to attached listeners.

Param Type DefaultValue Description
mParameters object

Parameters to pass along with the event

getDropEffect

Gets current value of property dropEffect.

Defines the visual drop effect.

Default value is "Move".

getDropLayout

Gets current value of property dropLayout.

Defines the layout of the droppable controls if dropPosition is set to Between or OnOrBetween.

Default value is "Default".

getDropPosition

Gets current value of property dropPosition.

Defines the position for the drop action, visualized by a rectangle.

Default value is "On".

sap.ui.core.dnd.DropInfo.getMetadata

Returns a metadata object for class sap.ui.core.dnd.DropInfo.

getTargetAggregation

Gets current value of property targetAggregation.

The aggregation name in the drop target control which is the target of this drag-and-drop action. If undefined, the entire control is the target. This can be handy if the target control does not have any aggregations or if the drop position within the target does not matter.

setDropEffect

Sets a new value for property dropEffect.

Defines the visual drop effect.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is "Move".

Param Type DefaultValue Description
sDropEffect sap.ui.core.dnd.DropEffect "Move"

New value for property dropEffect

setDropLayout

Sets a new value for property dropLayout.

Defines the layout of the droppable controls if dropPosition is set to Between or OnOrBetween.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is "Default".

Param Type DefaultValue Description
sDropLayout sap.ui.core.dnd.DropLayout "Default"

New value for property dropLayout

setDropPosition

Sets a new value for property dropPosition.

Defines the position for the drop action, visualized by a rectangle.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is "On".

Param Type DefaultValue Description
sDropPosition sap.ui.core.dnd.DropPosition "On"

New value for property dropPosition

setTargetAggregation

Sets a new value for property targetAggregation.

The aggregation name in the drop target control which is the target of this drag-and-drop action. If undefined, the entire control is the target. This can be handy if the target control does not have any aggregations or if the drop position within the target does not matter.

When called with a value of null or undefined, the default value of the property will be restored.

Param Type DefaultValue Description
sTargetAggregation string

New value for property targetAggregation