JavaScript“INDEX_SIZE_ERR:DOM 异常 1”在 DHTMLx 网格对象上执行 init() 时

发布于 2024-10-07 23:38:11 字数 1340 浏览 5 评论 0原文

我用的是 Joomla!利用 DHTMLxGrid 库的插件,特别是 1.5 版本。我在打开使用此 DHTMLx Grid 功能的页面时遇到问题,在 Firefox 中一切正常,但是,当我在 Chrome(7 和 8)中打开页面时,浏览器在 dhtmlxgrid.js 文件的第 60 行遇到异常,触发通过网格的初始化。我已经包含了几行代码,我知道这是非常有限的数据,但这是我能够放在这里作为摘要的内容。我希望有人遇到类似的问题。我对 JS 的了解有限,因此非常感谢您的帮助。

如果您需要更多细节,请告诉我,我会尝试提供更多数据。

谢谢!

php 文件:

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
    //...
}

js 文件:

//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
//...

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 help 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
//...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

万水千山粽是情ミ 2024-10-14 23:38:11

该错误意味着索引为负或太大。发生错误的行是向表中添加一行,但是有一个针对 _isKHTML 的测试...我假设正在测试 konqueror,它是 Chrome 所基于的 WebKit 的祖先。无论如何,尝试取出该测试并执行此操作:

  var hdrRow = this.hdr.insertRow(1);

如果这解决了问题,那么正在使用的浏览器嗅探就有问题,但如果您不必支持运行 KDE 的 Linux,那么没有它应该没问题。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文