gpt4 book ai didi

javascript - 当我尝试使用 extjs 网格编辑器插入新记录时,无法读取 null 错误的属性 'mergeAttributes'

转载 作者:行者123 更新时间:2023-11-28 04:47:20 26 4
gpt4 key购买 nike

首先,我使用的是6.2版本的extjs框架

我在使用带有“Ext.grid.plugin.RowEditing”插件的 ext.js 网格保存新记录时遇到问题。

当我尝试保存记录时,由于该行在编辑器中没有组合框,因此工作正常。

但是,当我在行编辑器中添加组合框时,出现以下错误:

Can not read property 'mergeAttributes' of null

通过检查 extjs 框架代码,我注意到当编辑器退出并且该行正在填充修改后的内容时会发生错误。

这发生在 Table.js 文件的以下部分:

    cellSelector = me.getCellSelector(column);
oldCell = oldRow.selectNode(cellSelector);
newCell = newRow.selectNode(cellSelector);

// Copy new cell attributes across. Use IE-specific method if possible.
if (oldCell.mergeAttributes) {
oldCell.mergeAttributes(newCell, true);
} else {
newAttrs = newCell.attributes;
attLen = newAttrs.length;
for (attrIndex = 0; attrIndex < attLen; attrIndex++) {
attName = newAttrs[attrIndex].name;
if (attName !== 'id') {
oldCell.setAttribute(attName, newAttrs[attrIndex].value);
}
}
}

基本上,变量“oldCell”没有被“oldRow.selectNode (cellSelector)”填充。

在第一列中,我放置了一个不可见的列,其中包含记录的 ID。该单元格正在被填充,但是,任何其他单元格,无论是否具有组合框,都会将“oldCell”返回为 null。

只是为了强制执行,当我从编辑器中删除所有组合框时,它会起作用。

只有新记录也是如此。

最佳答案

幸运的是,这个错误很容易修复。

我在放置组合框的列中有一个“渲染”。

此渲染中发生未处理的错误。所以,我纠正了它,错误就消失了。

关于javascript - 当我尝试使用 extjs 网格编辑器插入新记录时,无法读取 null 错误的属性 'mergeAttributes',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43240294/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com