3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
4 <title>The source code</title>
5 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
6 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
8 <body onload="prettyPrint();">
9 <pre class="prettyprint lang-js">/*!
10 * Ext JS Library 3.2.1
11 * Copyright(c) 2006-2010 Ext JS, Inc.
13 * http://www.extjs.com/license
18 Ext.Element.addMethods({
19 <div id="method-Ext.Element-autoHeight"></div>/**
20 * Measures the element's content height and updates height to match. Note: this function uses setTimeout so
21 * the new height may not be available immediately.
22 * @param {Boolean} animate (optional) Animate the transition (defaults to false)
23 * @param {Float} duration (optional) Length of the animation in seconds (defaults to .35)
24 * @param {Function} onComplete (optional) Function to call when animation completes
25 * @param {String} easing (optional) Easing method to use (defaults to easeOut)
26 * @return {Ext.Element} this
28 autoHeight : function(animate, duration, onComplete, easing){
29 var oldHeight = this.getHeight();
31 this.setHeight(1); // force clipping
32 setTimeout(function(){
33 var height = parseInt(this.dom.scrollHeight, 10); // parseInt for Safari
35 this.setHeight(height);
37 if(typeof onComplete == "function"){
41 this.setHeight(oldHeight); // restore original height
42 this.setHeight(height, animate, duration, function(){
44 if(typeof onComplete == "function") onComplete();
45 }.createDelegate(this), easing);
47 }.createDelegate(this), 0);