Module: alfresco/dnd/DragAndDropItems

alfresco/dnd/DragAndDropItems

This widget allows an array of items to be rendered which can be dragged and dropped (e.g. onto a DragAndDropTargetControl).
Author:
  • Dave Draper
License:
Source:

Members

acceptTypes :array

The array of types that this can be dropped if this is to be used as a target. Note that this has been added purely to support configurablility and extensions. If this is left as the default of null then it means that this cannot be used as a drag-and-drop target.
Type:
  • array
Default Value:
  • null
Source:

cssRequirements :Array

An array of the CSS files to use with this widget.
Type:
  • Array
Source:

dragWithHandles :boolean

Type:
  • boolean
Default Value:
  • false
Source:

immediateRender :boolean

Indicates that the items should be rendered immediately. This is a configurable option because the DragAndDropItemsListView needs to be able to prevent immediately rendering the item data.
Type:
  • boolean
Default Value:
  • true
Source:

items :array

The array of items to render as draggable entities. Each item should have a type array (indicating what targets it can be dropped onto), a label (to indicate its purpose) and a value (which can be any complex object).
Type:
  • array
Default Value:
  • null
Source:

selfAccept :boolean

Indicates whether or not items displayed can be re-arranged. Defaults to false.
Type:
  • boolean
Default Value:
  • false
Source:

templateString :String

The HTML template to use for the widget.
Type:
  • String
Source:

useItemsOnce :boolean

If this is configured to be true then once an item has been used it will be removed so that it cannot be used again. If the item is deleted it will be reinstated.
Type:
  • boolean
Default Value:
  • false
Source:

useItemsOnceComparisonKey :string

When items can only be used once this is the dot-notation property to compare deleted items against the configured items to see if a deleted item should be re-instated.
Type:
  • string
Default Value:
  • "name"
Source:

widgets :array

The widgets model to render as a drag-and-drop item.
Type:
  • array
Source:

Methods

creator(item)

Handles the creation of drag and drop avatars. This could check the supplied hint parameter to see if an avatar is required, but since the source doesn't allow self-copying and is not a target in itself then this is not necessary.
Parameters:
Name Type Description
item object The configuration for the dragged item.
Source:

onExternalItemSelected(payload)

Handles publications indicating that another DragAndDropItems widget publishing at the same scope has had an item selected. It checks that the publication didn't originate from the current instance and if not deselects all the items.
Parameters:
Name Type Description
payload object The payload containing the details of the widget that has had an item selected.
Source:

onItemAdded(payload)

Handles items being deleted. If the item deleted is a deleted item from this widget then it will be re-instated.
Parameters:
Name Type Description
payload object A payload containing a deleted item
Source:

onItemAddedByKeyboard(item)

Handles items being added via the keyboard. This checks to see whether items can only be used once and if this is the case it will remove the selected item.
Parameters:
Name Type Description
item object The item selected
Source:

onItemDeleted(payload)

Handles items being deleted. If the item deleted is a deleted item from this widget then it will be re-instated.
Parameters:
Name Type Description
payload object A payload containing a deleted item
Source:

onItemSelected(evt)

Handles the selection of an item. When an item is selected it will returned as the item to insert into a drag target when requested.
Parameters:
Name Type Description
evt object The selection event
Source:

onItemToAddRequest(payload)

Handles requests to provide an item to insert into a DragAndDropTarget
Parameters:
Name Type Description
payload object The payload of the request to add an item.
Source:

postCreate()

Creates a palette of items that can be dragged (and dropped).
Source:

renderData()

This function can be called to render the drag-and-drop items. It has this specific name so that it can be used as the renderer in the DragAndDropItemsListView
Source: