2 * Component layout for {@link Ext.view.BoundList}. Handles constraining the height to the configured maxHeight.
3 * @class Ext.layout.component.BoundList
4 * @extends Ext.layout.component.Component
7 Ext.define('Ext.layout.component.BoundList', {
8 extend: 'Ext.layout.component.Component',
9 alias: 'layout.boundlist',
13 beforeLayout: function() {
14 return this.callParent(arguments) || this.owner.refreshed > 0;
17 onLayout : function(width, height) {
20 floating = owner.floating,
23 isNumber = Ext.isNumber,
24 minWidth, maxWidth, minHeight, maxHeight,
25 naturalWidth, naturalHeight, constrainedWidth, constrainedHeight, undef;
28 // Position offscreen so the natural width is not affected by the viewport's right edge
29 el.setXY([-9999,-9999]);
32 // Calculate initial layout
33 me.setTargetSize(width, height);
35 // Handle min/maxWidth for auto-width
36 if (!isNumber(width)) {
37 minWidth = owner.minWidth;
38 maxWidth = owner.maxWidth;
39 if (isNumber(minWidth) || isNumber(maxWidth)) {
40 naturalWidth = el.getWidth();
41 if (naturalWidth < minWidth) {
42 constrainedWidth = minWidth;
44 else if (naturalWidth > maxWidth) {
45 constrainedWidth = maxWidth;
47 if (constrainedWidth) {
48 me.setTargetSize(constrainedWidth);
52 // Handle min/maxHeight for auto-height
53 if (!isNumber(height)) {
54 minHeight = owner.minHeight;
55 maxHeight = owner.maxHeight;
56 if (isNumber(minHeight) || isNumber(maxHeight)) {
57 naturalHeight = el.getHeight();
58 if (naturalHeight < minHeight) {
59 constrainedHeight = minHeight;
61 else if (naturalHeight > maxHeight) {
62 constrainedHeight = maxHeight;
64 if (constrainedHeight) {
65 me.setTargetSize(undef, constrainedHeight);
76 afterLayout: function() {
78 toolbar = me.owner.pagingToolbar;
81 toolbar.doComponentLayout();
85 setTargetSize : function(width, height) {
92 if (Ext.isNumber(height)) {
93 listHeight = height - owner.el.getFrameWidth('tb');
94 toolbar = owner.pagingToolbar;
96 listHeight -= toolbar.getHeight();
99 me.setElementSize(owner.listEl, null, listHeight);
101 me.callParent(arguments);