]> git.proxmox.com Git - extjs.git/blame - extjs/examples/classic/simple-tasks/app/ux/DropZone.js
add extjs 6.0.1 sources
[extjs.git] / extjs / examples / classic / simple-tasks / app / ux / DropZone.js
CommitLineData
6527f429
DM
1/**\r
2 * @class SimpleTasks.ux.DropZone\r
3 * @extends Ext.tree.ViewDropZone\r
4 * @private\r
5 */\r
6Ext.define('SimpleTasks.ux.DropZone', {\r
7 extend: 'Ext.tree.ViewDropZone',\r
8\r
9 handleNodeDrop : function(data, overRecord, position) {\r
10 var droppedRecord = data.records[0];\r
11\r
12 if(droppedRecord instanceof SimpleTasks.model.Task) {\r
13 this.cancelExpand();\r
14 this.fireViewEvent('taskdrop', droppedRecord, overRecord);\r
15 } else if(droppedRecord instanceof SimpleTasks.model.List) {\r
16 this.callParent(arguments);\r
17 this.fireViewEvent('listdrop', droppedRecord, overRecord, position);\r
18 }\r
19 },\r
20\r
21 onNodeOver: function(node, dragZone, e, data) {\r
22 var me = this,\r
23 view = me.view,\r
24 overRecord = view.getRecord(node),\r
25 position = me.getPosition(e, node),\r
26 targetNode = view.getRecord(node);\r
27\r
28 // if we're dragging to reorder rows within the List Tree, then call superclass onNodeOver.\r
29 // This allows the superclass to show the visual position indicator.\r
30 // Otherwise if we're dragging a Task from the Task Grid, do not show the indicator, since we want\r
31 // to give the appearance of the dragged record being dropped ON a node, not in between nodes.\r
32 if(data.records[0] instanceof SimpleTasks.model.List) {\r
33 return me.callParent(arguments);\r
34 }\r
35\r
36 // auto node expand check\r
37 this.cancelExpand();\r
38 if (position == 'append' && !this.expandProcId && !Ext.Array.contains(data.records, targetNode) && !targetNode.isLeaf() && !targetNode.isExpanded()) {\r
39 this.queueExpand(targetNode);\r
40 }\r
41 \r
42 me.overRecord = overRecord;\r
43 me.valid = true;\r
44 return me.dropAllowed;\r
45 }\r
46\r
47});