View Source

h2. Overview
_Since 3.0_

The {{<ace:droppable>}} tag makes another component capable of accepting draggable components on its area and firing events when this occurs.

{tip}See the ICEfaces Showcase [Live Demo|http://icefaces-showcase.icesoft.org/showcase.jsf?grp=aceMenu&exp=dragDropOverviewBean] of this component, complete with source code.{tip}

h2. Getting Started

The component we want to make droppable is specified as the value of the {{for}} attribute.

{panel}
{code:xml|borderStyle=dashed}
<h:panelGroup id="drop" styleClass="drop-area">
</h:panelGroup>

<ace:droppable for="drop" />
{code}
{panel}

Alernatively, the {{for}} value can be omitted and the parent component will be made droppable.

{panel}
{code:xml|borderStyle=dashed}
<h:panelGroup id="drop" styleClass="drop-area">
<ace:droppable />
</h:panelGroup>
{code}
{panel}

h2. Attributes
{tip:title=TagLib Documentation}This section covers attributes involved in the typical use-cases for this component. For reference, the complete taglib documentation for this component is available [here|http://www.icefaces.org/docs/v4_latest/ace/tld/ace/droppable.html].{tip}
{panel}
*for* Id of the component that will have the droppable behavior.
{panel}
{panel}
*accept* jQuery selector to define the set of acceptable draggables.
{panel}
{panel}
*scope* Keyword of this droppable component. Only draggables with the same keyword will be allowed to be dropped on this droppable.
{panel}
{panel}
*tolerance* Specifies the policy to determine when a draggable is considered to be 'over' the droppable. Possible values include: fit (draggable must be completely contained in droppable), intersect (> 50% of the draggable must be inside the droppable). pointer (cursor must be inside droppable) and touch (the draggable touches any part of the droppable).
{panel}

h2. Event Listeners
| dropListener | Method called whenever a draggable is moved into this droppable. The method receives a single DragDropEvent argument. |

h2. Client Behavior Events
| drop | Fired when a draggable component is dropped on this droppable component (default event). |

h2. JavaScript APIs

h4. ICEfaces 3.x

The client side component object is exposed through the global variable name specified in the *widgetVar* attribute.

h4. ICEfaces 4+

The "widgetVar" attribute on the ACE components has been removed in ICEfaces 4 and in its place a new "ice.ace.instance()" client JavaScript object lookup API has been introduced. The reason for this change is to enable lazy-initialization of the ACE component JavaScript objects to improve runtime performance and reduce browser memory use.

{code}var widget = ice.ace.instance('frm:componentId);{code}

{tip}The _ice.ace.instance_ function requires the _full_ client id of the component to be specified, such as "j_idt77:componentId" instead of just "componentId". To reduce the complexity of working with complete IDs with this function it may be preferable in some cases to use {{prependId="false"}} in the enclosing form (e.g. _<h:form prependId="false">_).{tip}

{info}This component doesn't have a client-side API made specifically to be used by application developers. However, the component's internal methods and variables can be accessed in this way, including the underlying jQuery object and objects from underlying Javascript libraries (if applicable), and can be used for whatever purpose a developer might have in mind.
{info}

{tip}Javascript callbacks can be supplied in the {{onStart}}, {{onError}}, {{onSuccess}}, and {{onComplete}} attributes of the {{<ace:ajax />}} tag for the {{drop}} event. The {{onStart}} callback must explicitly return {{true}} if the ajax event is to continue.{tip}

h2. Keyboard and ARIA support

At the moment, there is no keyboard and ARIA suppport.

h2. Known Issues

None.

h2. Other Resources

None.