extjs 重设autoHeight

autoHeight属性,只能在初始化组件的时候设置

在extjs中提供有obj.setHeight(height)方法,但没有提供obj.setAutoHeight(bool)方法,我们可以使用obj.setSize(widht,height)方法来实现

obj.autoHeight=true;

obj.setSize(undefined,0);

width值如果传递undefined进去,extjs会使用原来组件的宽度。因为autoHeight设置为true,height的值就失效了,所以在setSize中的height随便设置一个值就可以了,setSize方法相当于刷新的作用

obj.autoHeight=false;

obj.setSize(undefined,200);

autoHeight设置为false,使用setSize方法可以给组件重新设置高度。如果autoHeight=true,使用setHeight方法是无效的。

原文地址:https://www.cnblogs.com/timy/p/1792163.html