Friday, September 30, 2011

GWT 2.4 CellTable issue

Upgrading from GWT 2.3 to 2.4 caused a client-side exception in a
class of mine that extends CellTable. There has been no loss of
functionality, but the exception is a constant development annoyance.

com.google.gwt.core.client.JavaScriptException: (TypeError):
this.insertBefore is not a function

I've identified the line that causes this, though the exception
doesn't get thrown until the table is rendering later. In a row change
handler, MyCellTable removes the header Element when there are no rows
in the CellTable. Here's the code from inside the RowCountChangeEvent:

if (event.getNewRowCount() == 0) {
NodeList<Element> els =
getElement().getElementsByTagName("THEAD");
if (els.getLength() == 0) {
return;
}

Element headerElement = els.getItem(0);

headerElement.removeFromParent();
}

Downgrading to GWT 2.3 fixes the problem. I tried calling
headerElement.setAttribute("style", "display: none") instead of
removing the element, but that doesn't look the same (it still keeps a
few pixels there). I'm aware that creating a CellTable and then
ripping out pieces of it is probably a bad practice.

Are there any known changes in GWT 2.4 that could be causing this
problem? Can anyone think of a workaround?

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment