4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <title>The source code</title>
6 <link href="../prettify/prettify.css" type="text/css" rel="stylesheet" />
7 <script type="text/javascript" src="../prettify/prettify.js"></script>
8 <style type="text/css">
9 .highlight { display: block; background-color: #ddd; }
11 <script type="text/javascript">
12 function highlight() {
13 document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
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}. Handles constraining the height to the configured maxHeight.
20 * @class Ext.layout.component.BoundList
21 * @extends Ext.layout.component.Component
24 Ext.define('Ext.layout.component.BoundList', {
25 extend: 'Ext.layout.component.Component',
26 alias: 'layout.boundlist',
30 beforeLayout: function() {
31 return this.callParent(arguments) || this.owner.refreshed > 0;
34 onLayout : function(width, height) {
37 floating = owner.floating,
40 isNumber = Ext.isNumber,
41 minWidth, maxWidth, minHeight, maxHeight,
42 naturalWidth, naturalHeight, constrainedWidth, constrainedHeight, undef;
45 // Position offscreen so the natural width is not affected by the viewport's right edge
46 el.setXY([-9999,-9999]);
49 // Calculate initial layout
50 me.setTargetSize(width, height);
52 // Handle min/maxWidth for auto-width
53 if (!isNumber(width)) {
54 minWidth = owner.minWidth;
55 maxWidth = owner.maxWidth;
56 if (isNumber(minWidth) || isNumber(maxWidth)) {
57 naturalWidth = el.getWidth();
58 if (naturalWidth < minWidth) {
59 constrainedWidth = minWidth;
61 else if (naturalWidth > maxWidth) {
62 constrainedWidth = maxWidth;
64 if (constrainedWidth) {
65 me.setTargetSize(constrainedWidth);
69 // Handle min/maxHeight for auto-height
70 if (!isNumber(height)) {
71 minHeight = owner.minHeight;
72 maxHeight = owner.maxHeight;
73 if (isNumber(minHeight) || isNumber(maxHeight)) {
74 naturalHeight = el.getHeight();
75 if (naturalHeight < minHeight) {
76 constrainedHeight = minHeight;
78 else if (naturalHeight > maxHeight) {
79 constrainedHeight = maxHeight;
81 if (constrainedHeight) {
82 me.setTargetSize(undef, constrainedHeight);
93 afterLayout: function() {
95 toolbar = me.owner.pagingToolbar;
98 toolbar.doComponentLayout();
102 setTargetSize : function(width, height) {
109 if (Ext.isNumber(height)) {
110 listHeight = height - owner.el.getFrameWidth('tb');
111 toolbar = owner.pagingToolbar;
113 listHeight -= toolbar.getHeight();
116 me.setElementSize(owner.listEl, null, listHeight);
118 me.callParent(arguments);