View Full Version : difference between component.height and component.getHeight()

20 Jun 2014, 3:30 AM

What is the difference between component.height and component.getHeight(). What is the scenario in which both may have different value. I am using a container and in a scenario, I am getting the value of container.height as 700 but value of container.getHeight() as 500. Why is it happening. I am using ExtJs 4.1.3 and chrome on Windows environment.

20 Jun 2014, 8:53 PM

Component.height will return the height that you set for your component.
And according to the source code, component.getHeight() will call component.el.getHeight()....
that will return that actual height of the dom element, and if its not greater than 0 will return 0.

getHeight: function(contentHeight) {
var dom = this.dom,
height = contentHeight ? (dom.clientHeight - this.getPadding("tb")) : dom.offsetHeight;
return height > 0 ? height: 0;