gwt table td tr getOffsetHeight() inconsistency if border is set

In Gxt3 grid’s column header, if you set any border to the header row, your column header will grow. Also if you have filter in the header, even just hovering on the filter will cause the growth.

After digging into the code, the following code in ColumnHeader causes this: (my current version is 3.0.6)

This is the reason for the growth of hovering on filter .

    protected void activate() {
      if (!cm.isMenuDisabled(indexOf(this))) {
        XElement td = getElement().findParent("td", 3);
        int h = td.getHeight(true);
        if (!GXT.isChrome()) {
          getElement().setHeight(h, true);
        if (btn != null) {
, true);

This is the code in the protected void adjustColumnWidths(int[] columnWidths). which cause the growth when resize.

        if (rendered) {
          inner.setHeight(cell.getOffsetHeight(), true);

The root cause is from the “getOffsetHeight()” method, for some reason if a border-top/bottom is set to tr,  when getting the OffsetHeight of the td, the result will be (real height + half of the tr border). Notice here i am talking about getting the offset height of td, not tr. However it still includes the border set in tr.  Theoretically, offsetHeight should be the height of the visible area for an object, in pixels. The value contains the height with the padding, scrollBar, and the border, but does not include the margin. Not sure whether this is a bug or a normal behavior.

A example here.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s