我有一个带有选项卡的 jsp 页面。有时会出现错误(当我按下选项卡时)“无法读取未定义的属性‘switchToItem’”
Uncaught TypeError: Cannot read property 'switchToItem' of undefined
at init.__onHeaderClick (packed.js:6102)
at HTMLTableCellElement.<anonymous> (packed.js:1333)
at HTMLTableCellElement.dispatch (jquery.js:846)
at HTMLTableCellElement.eventHandle (jquery.js:722)
据我了解,错误发生在packed.js中(这是由4.3.4版本的richfaces打包的js文件)。我查看了该文件,发现 RichFaces 尝试查找选项卡列表。这些选项卡位于属性“rf”( element[richfaces.RICH_CONTAINER]
)中,但是当我按下选项卡时,没有属性。
此错误在 chrome v.57 中重现,在版本 56 中不会重现。 您能帮我提供一些建议吗?如何解决?
一些技术细节:
- 我使用
xmlns:rich="http://richfaces.org/rich"
<rich:tabPanel>
我的 jsp 页面中的标记 - 在 pom.xml
<richfaces.version>4.3.4.Final</richfaces.version>
最佳答案
James G,richfaces.js 中有一个错误
richfaces.$$ = function(componentName, element) {
while (element.parentNode) {
var containerId = element.getAttribute(richfaces.RICH_CONTAINER);
if (containerId && containerId !== "" && !!richfaces.COMPONENT_MAP[containerId] && richfaces.COMPONENT_MAP[containerId].component.name == componentName) {
return e.component;
}
else {
element = element.parentNode;
}
}
};
没有e
。您需要将其更改为
...
return richfaces.COMPONENT_MAP[containerId].component;
...
关于javascript - Chrome 57+ 上的 RichFaces 应用程序出现 JS 错误 "Cannot read property ' switchToItem' 未定义”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43072230/