You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

76 lines
2.7 KiB

2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>The source code</title>
  6. <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
  7. <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
  8. <style type="text/css">
  9. .highlight { display: block; background-color: #ddd; }
  10. </style>
  11. <script type="text/javascript">
  12. function highlight() {
  13. document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
  14. }
  15. </script>
  16. </head>
  17. <body onload="prettyPrint(); highlight();">
  18. <pre class="prettyprint lang-js">// private
  19. // This is a support class used internally by the Grid components
  20. Ext.grid.SplitDragZone = Ext.extend(Ext.dd.DDProxy, {
  21. fly: Ext.Element.fly,
  22. constructor : function(grid, hd, hd2){
  23. this.grid = grid;
  24. this.view = grid.getView();
  25. this.proxy = this.view.resizeProxy;
  26. Ext.grid.SplitDragZone.superclass.constructor.call(this, hd,
  27. &quot;gridSplitters&quot; + this.grid.getGridEl().id, {
  28. dragElId : Ext.id(this.proxy.dom), resizeFrame:false
  29. });
  30. this.setHandleElId(Ext.id(hd));
  31. this.setOuterHandleElId(Ext.id(hd2));
  32. this.scroll = false;
  33. },
  34. b4StartDrag : function(x, y){
  35. this.view.headersDisabled = true;
  36. this.proxy.setHeight(this.view.mainWrap.getHeight());
  37. var w = this.cm.getColumnWidth(this.cellIndex);
  38. var minw = Math.max(w-this.grid.minColumnWidth, 0);
  39. this.resetConstraints();
  40. this.setXConstraint(minw, 1000);
  41. this.setYConstraint(0, 0);
  42. this.minX = x - minw;
  43. this.maxX = x + 1000;
  44. this.startPos = x;
  45. Ext.dd.DDProxy.prototype.b4StartDrag.call(this, x, y);
  46. },
  47. handleMouseDown : function(e){
  48. var ev = Ext.EventObject.setEvent(e);
  49. var t = this.fly(ev.getTarget());
  50. if(t.hasClass(&quot;x-grid-split&quot;)){
  51. this.cellIndex = this.view.getCellIndex(t.dom);
  52. this.split = t.dom;
  53. this.cm = this.grid.colModel;
  54. if(this.cm.isResizable(this.cellIndex) &amp;&amp; !this.cm.isFixed(this.cellIndex)){
  55. Ext.grid.SplitDragZone.superclass.handleMouseDown.apply(this, arguments);
  56. }
  57. }
  58. },
  59. endDrag : function(e){
  60. this.view.headersDisabled = false;
  61. var endX = Math.max(this.minX, Ext.lib.Event.getPageX(e));
  62. var diff = endX - this.startPos;
  63. this.view.onColumnSplitterMoved(this.cellIndex, this.cm.getColumnWidth(this.cellIndex)+diff);
  64. },
  65. autoOffset : function(){
  66. this.setDelta(0,0);
  67. }
  68. });</pre>
  69. </body>
  70. </html>