DragZone2.html
2.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>The source code</title>
<link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="../resources/prettify/prettify.js"></script>
<style type="text/css">
.highlight { display: block; background-color: #ddd; }
</style>
<script type="text/javascript">
function highlight() {
document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
}
</script>
</head>
<body onload="prettyPrint(); highlight();">
<pre class="prettyprint lang-js"><span id='Ext-grid-header-DragZone'>/**
</span> * @private
*/
Ext.define('Ext.grid.header.DragZone', {
extend: 'Ext.dd.DragZone',
colHeaderCls: Ext.baseCSSPrefix + 'column-header',
maxProxyWidth: 120,
constructor: function(headerCt) {
this.headerCt = headerCt;
this.ddGroup = this.getDDGroup();
this.callParent([headerCt.el]);
this.proxy.el.addCls(Ext.baseCSSPrefix + 'grid-col-dd');
},
getDDGroup: function() {
return 'header-dd-zone-' + this.headerCt.up('[scrollerOwner]').id;
},
getDragData: function(e) {
var header = e.getTarget('.'+this.colHeaderCls),
headerCmp,
ddel;
if (header) {
headerCmp = Ext.getCmp(header.id);
if (!this.headerCt.dragging && headerCmp.draggable && !(headerCmp.isOnLeftEdge(e) || headerCmp.isOnRightEdge(e))) {
ddel = document.createElement('div');
ddel.innerHTML = Ext.getCmp(header.id).text;
return {
ddel: ddel,
header: headerCmp
};
}
}
return false;
},
onBeforeDrag: function() {
return !(this.headerCt.dragging || this.disabled);
},
onInitDrag: function() {
this.headerCt.dragging = true;
this.callParent(arguments);
},
onDragDrop: function() {
this.headerCt.dragging = false;
this.callParent(arguments);
},
afterRepair: function() {
this.callParent();
this.headerCt.dragging = false;
},
getRepairXY: function() {
return this.dragData.header.el.getXY();
},
disable: function() {
this.disabled = true;
},
enable: function() {
this.disabled = false;
}
});
</pre>
</body>
</html>