Chapter 16. Drag and drop

Read this chapter for details on adding drag and drop support to controls.

16.1. <rich:dragSource>

The <rich:dragSource> component can be added to a component to indicate it is capable of being dragged by the user. The dragged item can then be dropped into a compatible drop area, designated using the <rich:dropTarget> component.

16.1.1. Basic usage

To add drag support to a component, attach the <rich:dragSource> component as a child element.
The type attribute must be specified, and can be any identifying string. Dragged items can only be dropped in drop zones where the type attribute of the <rich:dragSource> component is listed in the acceptedTypes attribute of the <rich:dropTarget> component.

16.1.2. Dragging an object

Use the dragIndicator parameter to customize the appearance of a dragged object while it is being dragged. The dragIndicator parameter must point to the id identifier of a <rich:dragIndicator> component. If the dragIndicator attribute is not defined, the drag indicator appears as a clone of the <rich:dragSource> component's parent control.
To bind data to the dragged object, use the dragValue attribute. The dragValue attribute specifies a server-side object, which is then bound to the parent component when it is dragged. This facilitates handling event data during a drop event.

16.1.3. Reference data

  • component-type: org.richfaces.DragSource
  • component-class: org.richfaces.component.UIDragSource
  • component-family: org.richfaces.DragSource
  • renderer-type: org.richfaces.DragSourceRenderer