BoundList.html 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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-layout-component-BoundList'>/**
  19. </span> * Component layout for {@link Ext.view.BoundList}.
  20. * @private
  21. */
  22. Ext.define('Ext.layout.component.BoundList', {
  23. extend: 'Ext.layout.component.Auto',
  24. alias: 'layout.boundlist',
  25. type: 'component',
  26. beginLayout: function(ownerContext) {
  27. var me = this,
  28. owner = me.owner,
  29. toolbar = owner.pagingToolbar;
  30. me.callParent(arguments);
  31. if (owner.floating) {
  32. ownerContext.savedXY = owner.el.getXY();
  33. // move way offscreen to prevent any constraining
  34. owner.el.setXY([-9999, -9999]);
  35. }
  36. if (toolbar) {
  37. ownerContext.toolbarContext = ownerContext.context.getCmp(toolbar);
  38. }
  39. ownerContext.listContext = ownerContext.getEl('listEl');
  40. },
  41. beginLayoutCycle: function(ownerContext){
  42. var owner = this.owner;
  43. this.callParent(arguments);
  44. if (ownerContext.heightModel.auto) {
  45. // Set the el/listEl to be autoHeight since they may have been previously sized
  46. // by another layout process. If the el was at maxHeight first, the listEl will
  47. // always size to the maxHeight regardless of the content.
  48. owner.el.setHeight('auto');
  49. owner.listEl.setHeight('auto');
  50. }
  51. },
  52. getLayoutItems: function() {
  53. var toolbar = this.owner.pagingToolbar;
  54. return toolbar ? [toolbar] : [];
  55. },
  56. isValidParent: function() {
  57. // this only ever gets called with the toolbar, since it's rendered inside we
  58. // know the parent is always valid
  59. return true;
  60. },
  61. finishedLayout: function(ownerContext) {
  62. var xy = ownerContext.savedXY;
  63. this.callParent(arguments);
  64. if (xy) {
  65. this.owner.el.setXY(xy);
  66. }
  67. },
  68. measureContentWidth: function(ownerContext) {
  69. return this.owner.listEl.getWidth();
  70. },
  71. measureContentHeight: function(ownerContext) {
  72. return this.owner.listEl.getHeight();
  73. },
  74. publishInnerHeight: function(ownerContext, height) {
  75. var toolbar = ownerContext.toolbarContext,
  76. toolbarHeight = 0;
  77. if (toolbar) {
  78. toolbarHeight = toolbar.getProp('height');
  79. }
  80. if (toolbarHeight === undefined) {
  81. this.done = false;
  82. } else {
  83. ownerContext.listContext.setHeight(height - ownerContext.getFrameInfo().height - toolbarHeight);
  84. }
  85. },
  86. calculateOwnerHeightFromContentHeight: function(ownerContext){
  87. var height = this.callParent(arguments),
  88. toolbar = ownerContext.toolbarContext;
  89. if (toolbar) {
  90. height += toolbar.getProp('height');
  91. }
  92. return height;
  93. }
  94. });</pre>
  95. </body>
  96. </html>