异常描述:Tabpanel中加入应用了RowExpander.js插件的Grid,当点击关闭Tabpanel时,浏览器
报出 this.grid.getView().mainBody未定义。
异常解决:在RowExpander.js的源码中第139行的onDestroy方法中添加mainBody是否存在的判断
onDestroy: function() {
this.keyNav.disable();
delete this.keyNav;
var mainBody = this.grid.getView().mainBody;
if(mainBody!=undefined){
mainBody.un('mousedown', this.onMouseDown, this);
}
},
异常备注:Tabpanel触发close事件的时候,会去销毁底下相应的DOM,移除了GRID后,再触发了
RowExpander插件的onDestory()事件,此时GRID已经不存在了,因此找不到mainBody
这个元素,引发异常
报出 this.grid.getView().mainBody未定义。
异常解决:在RowExpander.js的源码中第139行的onDestroy方法中添加mainBody是否存在的判断
onDestroy: function() {
this.keyNav.disable();
delete this.keyNav;
var mainBody = this.grid.getView().mainBody;
if(mainBody!=undefined){
mainBody.un('mousedown', this.onMouseDown, this);
}
},
异常备注:Tabpanel触发close事件的时候,会去销毁底下相应的DOM,移除了GRID后,再触发了
RowExpander插件的onDestory()事件,此时GRID已经不存在了,因此找不到mainBody
这个元素,引发异常
本文介绍了解决Tabpanel结合RowExpander.js插件时出现的mainBody未定义错误的方法。通过在RowExpander.js的onDestroy方法中增加对mainBody存在性的检查,避免了因DOM销毁导致的问题。
4297

被折叠的 条评论
为什么被折叠?



