Module: alfresco/forms/controls/DragAndDropTargetControl

alfresco/forms/controls/DragAndDropTargetControl

This form control can be used for constructing form data through a drag and drop interface. Include this widget in a form and it will render a DragAndDropTarget that can be used to drop items dragged from a DragAndDropItems widget.

When configured the control you can choose whether or not to use a modelling service (recommended for finer control) as well as overriding the widget model for wrapping dropped items and the [widget model for rendering each dropped item]{@link module:alfresco/form/controls/DragAndDropTargetControl#widgetsForDroppedItems}} (although the latter configuration might get overriden by your modelling service configuration).

Author:
  • Dave Draper
License:
Source:

Members

clearDroppedItemsTopic :string

Defines a topic to subscribe to that if published on will result in all of the dropped items being deleted. The difference between this topic and the clearTopic is that single-use items that have been used WILL be returned to the DragAndDropItems widget from which they were dragged.
Type:
  • string
Default Value:
  • null
Source:

clearTopic :string

Defines a topic to subscribe to that if published on will result in all of the dropped items being deleted. The difference between this topic and the clearDroppedItemsTopic is that single-use items that have been used will NOT be returned to the DragAndDropItems widget from which they were dragged.
Type:
  • string
Default Value:
  • null
Source:

useModellingService :boolean

Indicates whether or not to use a modelling service to render the dropped items. This will result in publications being made to request the widgets to use for each dropped item based on the value of the dropped item.
Type:
  • boolean
Default Value:
  • false
Source:

widgetsForControl :array

This can be set to be an array containing a single widget definition. The array structure is used in order for Surf dynamic-dependency analysis to include the required widget resources on the page. Only the "name" attribute of the first widget in the page will be used, other configuration will be ignored.
Type:
  • array
Default Value:
  • null
Source:

widgetsForDroppedItems :array

An optional model to override the default widgets used for rendering a dropped item.
Type:
  • array
Default Value:
  • null
Source:

widgetsForWrappingDroppedItems :array

An optional model to override the default widgets used for rendering the wrapper around a dropped item.
Type:
  • array
Default Value:
  • null
Source:

withHandles :boolean

Indicates whether or not dragging should be done with handles.
Type:
  • boolean
Default Value:
  • true
Source:

Methods

createFormControl(config)

Instantiates a new DragAndDropTarget widget.
Parameters:
Name Type Description
config config The configuration to instantiate the control with.
Source:

getWidgetConfig()

Return the configuration for the widget
Source:

onClear()

This function wipes the canvas, discarding nodes it contains.
Source:

onClearDroppedItems()

This function wipes the canvas by running the deletion process of any nodes it contains. The nodes will therefore return to their palettes of origin if required.
Source:

onDragAndDropTargetUpdated(name, oldValue, value)

Handles the change in value for the current form control by publishing the details of the change and calling the validate function to check that the new value is acceptable.
Parameters:
Name Type Description
name string
oldValue string
value string
Source:

setupChangeEvents()

Overrides the inherited function to listen to update events generated when items are added or removed from the control.
Source:

startup()

Creates subscriptions to the clearTopic and clearDroppedItemsTopic topics (if configured) in order
Source: