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.

112 lines
3.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"><span id='Ext-grid-AbstractSelectionModel-method-constructor'><span id='Ext-grid-AbstractSelectionModel'>/**
  19. </span></span> * @class Ext.grid.AbstractSelectionModel
  20. * @extends Ext.util.Observable
  21. * Abstract base class for grid SelectionModels. It provides the interface that should be
  22. * implemented by descendant classes. This class should not be directly instantiated.
  23. * @constructor
  24. */
  25. Ext.grid.AbstractSelectionModel = Ext.extend(Ext.util.Observable, {
  26. <span id='Ext-grid-AbstractSelectionModel-property-grid'> /**
  27. </span> * The GridPanel for which this SelectionModel is handling selection. Read-only.
  28. * @type Object
  29. * @property grid
  30. */
  31. constructor : function(){
  32. this.locked = false;
  33. Ext.grid.AbstractSelectionModel.superclass.constructor.call(this);
  34. },
  35. <span id='global-method-init'> /** @ignore Called by the grid automatically. Do not call directly. */
  36. </span> init : function(grid){
  37. this.grid = grid;
  38. if(this.lockOnInit){
  39. delete this.lockOnInit;
  40. this.locked = false;
  41. this.lock();
  42. }
  43. this.initEvents();
  44. },
  45. <span id='Ext-grid-AbstractSelectionModel-method-lock'> /**
  46. </span> * Locks the selections.
  47. */
  48. lock : function(){
  49. if(!this.locked){
  50. this.locked = true;
  51. // If the grid has been set, then the view is already initialized.
  52. var g = this.grid;
  53. if(g){
  54. g.getView().on({
  55. scope: this,
  56. beforerefresh: this.sortUnLock,
  57. refresh: this.sortLock
  58. });
  59. }else{
  60. this.lockOnInit = true;
  61. }
  62. }
  63. },
  64. <span id='Ext-grid-AbstractSelectionModel-method-sortLock'> // set the lock states before and after a view refresh
  65. </span> sortLock : function() {
  66. this.locked = true;
  67. },
  68. <span id='Ext-grid-AbstractSelectionModel-method-sortUnLock'> // set the lock states before and after a view refresh
  69. </span> sortUnLock : function() {
  70. this.locked = false;
  71. },
  72. <span id='Ext-grid-AbstractSelectionModel-method-unlock'> /**
  73. </span> * Unlocks the selections.
  74. */
  75. unlock : function(){
  76. if(this.locked){
  77. this.locked = false;
  78. var g = this.grid,
  79. gv;
  80. // If the grid has been set, then the view is already initialized.
  81. if(g){
  82. gv = g.getView();
  83. gv.un('beforerefresh', this.sortUnLock, this);
  84. gv.un('refresh', this.sortLock, this);
  85. }else{
  86. delete this.lockOnInit;
  87. }
  88. }
  89. },
  90. <span id='Ext-grid-AbstractSelectionModel-method-isLocked'> /**
  91. </span> * Returns true if the selections are locked.
  92. * @return {Boolean}
  93. */
  94. isLocked : function(){
  95. return this.locked;
  96. },
  97. <span id='Ext-grid-AbstractSelectionModel-method-destroy'> destroy: function(){
  98. </span> this.unlock();
  99. this.purgeListeners();
  100. }
  101. });</pre>
  102. </body>
  103. </html>