I use a Joomla! plugin that takes advantage of the DHTMLxGrid library, particularly version 1.5. I have problem when opening the page that uses this DHTMLx Grid functionality, everything works fine with Firefox, however, when I open the page in Chrome (7 and 8) the browser hits an exception on line 60 of the dhtmlxgrid.js file, triggered by the initialization of the grid. I have included a few lines of code, I know this is very limited data, but this is what I was able to to put here as a summary. I hope someone encountered a similar problem. I have limited knowledge of JS, so any h开发者_如何学运维elp is greatly appreciated.
If you need more specifics, let me know and I will try to include more data.
Thanks!
The php file:
function gridInit(){
mygrid = new dhtmlXGridObject('gridbox');
mygrid.setImagePath("http://mydomain.com//administrator/components/com_com/images/dhtmlxGrid/");
mygrid.setHeader("ID,Start Period,End Period,Price (USD)");
mygrid.setInitWidths("50,120,120,80");
mygrid.setColAlign("center,center,center,center");
mygrid.setColTypes("dyn,dhxCalendarA,dhxCalendarA,edn");
mygrid.setDateFormat("%d/%m/%Y");
mygrid.setColSorting("int,date,date,int");
mygrid.init(); //...hits exception at this point
//...
}
The js file:
//dhtmlxgrid.js...
this.hdr = document.createElement("TABLE");
this.hdr.style.border="1px solid gray";
this.hdr.cellSpacing = 0;
this.hdr.cellPadding = 0;
if ((!_isOpera)||(_OperaRv>=8.5))
this.hdr.style.tableLayout = "fixed";
this.hdr.className = "c_hdr".substr(2);
this.hdr.width = "100%";
//...
var hdrRow = this.hdr.insertRow(_isKHTML?2:1); //dhtmlxgrid.js:60 Uncaught Error: INDEX_SIZE_ERR: DOM Exception 1
//...
The error means an index is negative or too large. The line the error happens on is adding a row to a table, but there is a test for _isKHTML... I assume that is testing for konqueror, which was the progenitor of WebKit which Chrome is based on. Anyhow, try taking out that test and doing this instead:
var hdrRow = this.hdr.insertRow(1);
If that resolves the problem then the browser sniffing being used there is at fault, but if you don't have to support Linux running KDE then you should be fine without it.
精彩评论