4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <title>The source code</title>
6 <link href="../prettify/prettify.css" type="text/css" rel="stylesheet" />
7 <script type="text/javascript" src="../prettify/prettify.js"></script>
8 <style type="text/css">
9 .highlight { display: block; background-color: #ddd; }
11 <script type="text/javascript">
12 function highlight() {
13 document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
17 <body onload="prettyPrint(); highlight();">
18 <pre class="prettyprint lang-js"><span id='Ext-dd-DropTarget-method-constructor'><span id='Ext-dd-DropTarget'>/**
19 </span></span> * @class Ext.dd.DropTarget
20 * @extends Ext.dd.DDTarget
21 * A simple class that provides the basic implementation needed to make any element a drop target that can have
22 * draggable items dropped onto it. The drop has no effect until an implementation of notifyDrop is provided.
24 * @param {Mixed} el The container element
25 * @param {Object} config
27 Ext.define('Ext.dd.DropTarget', {
28 extend: 'Ext.dd.DDTarget',
29 requires: ['Ext.dd.ScrollManager'],
31 constructor : function(el, config){
32 this.el = Ext.get(el);
34 Ext.apply(this, config);
36 if(this.containerScroll){
37 Ext.dd.ScrollManager.register(this.el);
40 this.callParent([this.el.dom, this.ddGroup || this.group,
44 <span id='Ext-dd-DropTarget-cfg-ddGroup'> /**
45 </span> * @cfg {String} ddGroup
46 * A named drag drop group to which this object belongs. If a group is specified, then this object will only
47 * interact with other drag drop objects in the same group (defaults to undefined).
49 <span id='Ext-dd-DropTarget-cfg-overClass'> /**
50 </span> * @cfg {String} overClass
51 * The CSS class applied to the drop target element while the drag source is over it (defaults to "").
53 <span id='Ext-dd-DropTarget-cfg-dropAllowed'> /**
54 </span> * @cfg {String} dropAllowed
55 * The CSS class returned to the drag source when drop is allowed (defaults to "x-dd-drop-ok").
57 dropAllowed : Ext.baseCSSPrefix + 'dd-drop-ok',
58 <span id='Ext-dd-DropTarget-cfg-dropNotAllowed'> /**
59 </span> * @cfg {String} dropNotAllowed
60 * The CSS class returned to the drag source when drop is not allowed (defaults to "x-dd-drop-nodrop").
62 dropNotAllowed : Ext.baseCSSPrefix + 'dd-drop-nodrop',
68 isNotifyTarget : true,
70 <span id='Ext-dd-DropTarget-method-notifyEnter'> /**
71 </span> * The function a {@link Ext.dd.DragSource} calls once to notify this drop target that the source is now over the
72 * target. This default implementation adds the CSS class specified by overClass (if any) to the drop element
73 * and returns the dropAllowed config value. This method should be overridden if drop validation is required.
74 * @param {Ext.dd.DragSource} source The drag source that was dragged over this drop target
75 * @param {Event} e The event
76 * @param {Object} data An object containing arbitrary data supplied by the drag source
77 * @return {String} status The CSS class that communicates the drop status back to the source so that the
78 * underlying {@link Ext.dd.StatusProxy} can be updated
80 notifyEnter : function(dd, e, data){
82 this.el.addCls(this.overClass);
84 return this.dropAllowed;
87 <span id='Ext-dd-DropTarget-method-notifyOver'> /**
88 </span> * The function a {@link Ext.dd.DragSource} calls continuously while it is being dragged over the target.
89 * This method will be called on every mouse movement while the drag source is over the drop target.
90 * This default implementation simply returns the dropAllowed config value.
91 * @param {Ext.dd.DragSource} source The drag source that was dragged over this drop target
92 * @param {Event} e The event
93 * @param {Object} data An object containing arbitrary data supplied by the drag source
94 * @return {String} status The CSS class that communicates the drop status back to the source so that the
95 * underlying {@link Ext.dd.StatusProxy} can be updated
97 notifyOver : function(dd, e, data){
98 return this.dropAllowed;
101 <span id='Ext-dd-DropTarget-method-notifyOut'> /**
102 </span> * The function a {@link Ext.dd.DragSource} calls once to notify this drop target that the source has been dragged
103 * out of the target without dropping. This default implementation simply removes the CSS class specified by
104 * overClass (if any) from the drop element.
105 * @param {Ext.dd.DragSource} source The drag source that was dragged over this drop target
106 * @param {Event} e The event
107 * @param {Object} data An object containing arbitrary data supplied by the drag source
109 notifyOut : function(dd, e, data){
111 this.el.removeCls(this.overClass);
115 <span id='Ext-dd-DropTarget-method-notifyDrop'> /**
116 </span> * The function a {@link Ext.dd.DragSource} calls once to notify this drop target that the dragged item has
117 * been dropped on it. This method has no default implementation and returns false, so you must provide an
118 * implementation that does something to process the drop event and returns true so that the drag source's
119 * repair action does not run.
120 * @param {Ext.dd.DragSource} source The drag source that was dragged over this drop target
121 * @param {Event} e The event
122 * @param {Object} data An object containing arbitrary data supplied by the drag source
123 * @return {Boolean} False if the drop was invalid.
125 notifyDrop : function(dd, e, data){
129 destroy : function(){
131 if(this.containerScroll){
132 Ext.dd.ScrollManager.unregister(this.el);