HeaderReorderer.html 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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"><span id='Ext-grid-plugin-HeaderReorderer'>/**
  19. </span> * @private
  20. */
  21. Ext.define('Ext.grid.plugin.HeaderReorderer', {
  22. extend: 'Ext.AbstractPlugin',
  23. requires: ['Ext.grid.header.DragZone', 'Ext.grid.header.DropZone'],
  24. alias: 'plugin.gridheaderreorderer',
  25. init: function(headerCt) {
  26. this.headerCt = headerCt;
  27. headerCt.on({
  28. render: this.onHeaderCtRender,
  29. single: true,
  30. scope: this
  31. });
  32. },
  33. <span id='Ext-grid-plugin-HeaderReorderer-method-destroy'> /**
  34. </span> * @private
  35. * AbstractComponent calls destroy on all its plugins at destroy time.
  36. */
  37. destroy: function() {
  38. Ext.destroy(this.dragZone, this.dropZone);
  39. },
  40. onHeaderCtRender: function() {
  41. var me = this;
  42. me.dragZone = new Ext.grid.header.DragZone(me.headerCt);
  43. me.dropZone = new Ext.grid.header.DropZone(me.headerCt);
  44. if (me.disabled) {
  45. me.dragZone.disable();
  46. }
  47. },
  48. enable: function() {
  49. this.disabled = false;
  50. if (this.dragZone) {
  51. this.dragZone.enable();
  52. }
  53. },
  54. disable: function() {
  55. this.disabled = true;
  56. if (this.dragZone) {
  57. this.dragZone.disable();
  58. }
  59. }
  60. });
  61. </pre>
  62. </body>
  63. </html>