dhtmlxgrid, facelets and Firefox

I added dhtmlxgrid(v1.4) into facelets. The page renders in IE but does not in Firefox 2.0.0.9. The Firefox error console points to the following statement “var r = this.xHdr.insertRow(0)” in dhtmlxGrid.js as the cause of the problem. The error message reads “this.xHdr.insertRow is not a function”. It does not even show the grid headers.



The page renders without errors in IE.

This is pretty stange error in source code the next statement present

   this.xHdr = document.createElement(“TABLE”);
   …
   var r = this.xHdr.insertRow(0)

so there is no way in normal situation that this.xHdr will not have necessary methods.
The only possible reason of problem - the container used as source of grid is not attached to DOM at all ( some kind of node which was created, but not attached to DOM ) , in such case grid initialization may fail.


You can try it your self. It is easy to reproduce. Use any of your examples and convert it to use facelets (instead of plain html) and package it as a war file and deploy. Like I said earlier, it works fine under IE. The problem only happens in FF.



I have hit the same problem today under dhtmlxgrid 1.5 using Firefox 2.0.0.11



this.xHdr.insertRow is not a function



  dhtmlXGridObject(“gridbox”)



     var r = this.xHdr.insertRow(0)



and firebug says it is dhtmlxgrid.js (line 23)



(header of dhtmlxgrid.js says //v.1.5 build 71114 )



The same code is working fine under IE 6.0



Has anyone found a solution, or cause, of this?

If problem still occurs for you - please provide any kind of sample where it can be reconstructed ( you can send it directly to support@dhtmlx.com )

I have the same issue. Which looks fixable.

The problem is that I am displaying pages in strict html.

My headers are:

header(‘Content-Type: application/xhtml+xml; charset=utf-8’);

If I switch this off them my issue goes away.  Looking on the internet:

In HTML, Document.createElement() will create an element in the HTML namespace.
In XML (including XHTML), the namespace is defined by both DOM2 and DOM3 to be
null.

  • In XHTML, browsers lack interoperability in this area. In Firefox, the namespace is dependent upon the MIME type. In Opera, it's dependent upon the root element and in Safari, it's always null.
So, it looks fixable. You just have to create the table differently. There may be more after this though due to the header.


header(‘Content-Type: application/xhtml+xml; charset=utf-8’);
We not support usage of grid with such docuement content type
Not only the grid creation code must be different , but the DOM operation with grid need to be slightly adjusted as well, and introduced changes will break work of grid in older browsers.

I have always wanted to use your products but have been drawing back from doing so because they do not work fine with facelets and firefox. Is there a fix for the above problem? I have just tried your latest version of the grid (1.6) and I am getting the same problem with firefox 2.0.0.14 and facelets. The same source code (nothing changed) works fine in IE 7.

Another Jonathan

The component itself work in both IE and FF, the problem in your case most probably caused by some specific of Facelets framework
We will check possible reasons of the problems.