X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/0494b8d9b9bb03ab6c22b34dae81261e3cd7e3e6..7a654f8d43fdb43d78b63d90528bed6e86b608cc:/src/grid/plugin/DragDrop.js diff --git a/src/grid/plugin/DragDrop.js b/src/grid/plugin/DragDrop.js new file mode 100644 index 00000000..55fa4e27 --- /dev/null +++ b/src/grid/plugin/DragDrop.js @@ -0,0 +1,155 @@ +/** + * @class Ext.grid.plugin.DragDrop + *
This plugin provides drag and/or drop functionality for a GridView.
+ *It creates a specialized instance of {@link Ext.dd.DragZone DragZone} which knows how to drag out of a {@link Ext.grid.View GridView} + * and loads the data object which is passed to a cooperating {@link Ext.dd.DragZone DragZone}'s methods with the following properties:
copy
property, or true
if the GridView was configured
+ * with allowCopy: true
and the control key was pressed when the drag operation was begun.It also creates a specialized instance of {@link Ext.dd.DropZone} which cooperates with other DropZones which are members of the same + * ddGroup which processes such data objects.
+ *Adding this plugin to a view means that two new events may be fired from the client GridView, {@link #event-beforedrop beforedrop}
and
+ * {@link #event-drop drop}
This event is fired through the GridView. Add listeners to the GridView object
+ *Fired when a drop gesture has been triggered by a mouseup event in a valid drop position in the GridView. + * @param {HtmlElement} node The GridView node if any over which the mouse was positioned.
+ *Returning false
to this event signals that the drop gesture was invalid, and if the drag proxy
+ * will animate back to the point from which the drag began.
Returning 0
To this event signals that the data transfer operation should not take place, but
+ * that the gesture was valid, and that the repair operation should not take place.
Any other return value continues with the data transfer operation.
+ * @param {Object} data The data object gathered at mousedown time by the cooperating {@link Ext.dd.DragZone DragZone}'s + * {@link Ext.dd.DragZone#getDragData getDragData} method it contains the following properties:copy
property, or true
if the GridView was configured
+ * with allowCopy: true
and the control key was pressed when the drag operation was begun"before"
or "after"
depending on whether the mouse is above or below the midline of the node.
+ * @param {Function} dropFunction A function to call to complete the data transfer operation and either move or copy Model instances from the source + * View's Store to the destination View's Store.
+ *This is useful when you want to perform some kind of asynchronous processing before confirming + * the drop, such as an {@link Ext.window.MessageBox#confirm confirm} call, or an Ajax request.
+ *Return 0
from this event handler, and call the dropFunction
at any time to perform the data transfer.
copy
property, or true
if the GridView was configured
+ * with allowCopy: true
and the control key was pressed when the drag operation was begun"before"
or "after"
depending on whether the mouse is above or below the midline of the node.
+ */
+
+ dragText : '{0} selected row{1}',
+
+ /**
+ * @cfg {String} ddGroup
+ * A named drag drop group to which this object belongs. If a group is specified, then both the DragZones and DropZone
+ * used by this plugin will only interact with other drag drop objects in the same group (defaults to 'TreeDD').
+ */
+ ddGroup : "GridDD",
+
+ /**
+ * @cfg {String} dragGroup
+ * The ddGroup to which the DragZone will belong.
+ *This defines which other DropZones the DragZone will interact with. Drag/DropZones only interact with other Drag/DropZones + * which are members of the same ddGroup.
+ */ + + /** + * @cfg {String} dropGroup + *The ddGroup to which the DropZone will belong.
+ *This defines which other DragZones the DropZone will interact with. Drag/DropZones only interact with other Drag/DropZones + * which are members of the same ddGroup.
+ */ + + /** + * @cfg {Boolean} enableDrop + *Defaults to true
Set to false
to disallow the View from accepting drop gestures
Defaults to true
Set to false
to disallow dragging items from the View