msgTree.on("click", function(id) {
if(id.id==11){
content.add({
xtype:'panel',
height:500,
// closable: true,
id:'all_log',
title:'全局日志',
html : '<iframe scrolling="auto" frameborder="0" width="100%" height="100%" src="../logPanel/allLog.html"></iframe>'
});
}
if(id.id==12){
content.add({
xtype:'panel',
height:500,
closable: true,
id:'dns_log',
title:'DNS日志',
html : '<iframe scrolling="auto" frameborder="0" width="100%" height="100%" src="../logPanel/dnsLog.html"></iframe>'
});
}
if(id.id==13){
content.add({
xtype:'panel',
height:500,
closable: true,
id:'email_log',
title:'Email信息',
html : '<iframe scrolling="auto" frameborder="0" width="100%" height="100%" src="../logPanel/allLog.html"></iframe>'
});
}
if(id.id==14){
content.add({
xtype:'panel',
height:500,
closable: true,
id:'ftp_log',
title:'FTP传输',
html : '<iframe scrolling="auto" frameborder="0" width="100%" height="100%" src="../logPanel/ftpLog.html"></iframe>'
});
}
if(id.id==15){
content.add({
xtype:'panel',
height:500,
closable: true,
id:'http_log',
title:'HTTP请求日志',
html : '<iframe scrolling="auto" frameborder="0" width="100%" height="100%" src="../logPanel/httpLog.html"></iframe>'
});
}
if(id.id==16){
content.add({
xtype:'panel',
height:500,
closable: true,
id:'msn_log',
title:'MSN日志',
html : '<iframe scrolling="auto" frameborder="0" width="100%" height="100%" src="../logPanel/msnLog.html"></iframe>'
});
}
if(id.id==17){
content.add({
xtype:'panel',
height:500,
closable: true,
id:'yahoo_log',
title:'Yahoo日志',
html : '<iframe scrolling="auto" frameborder="0" width="100%" height="100%" src="../logPanel/yahooLog.html"></iframe>'
});
});以上的代码是我通过左侧的树形菜单控制右边的tab,是属于动态加载的。点击一个菜单就会相应的打开一个tab。
但是奇怪的是,有时候我点击一个tab打开的却是另一个tab。(比如我打开MSN日志,但是弹出来的确实Yahoo日志)而且这种情况会偶尔出现。我开页面的属性时,发现MSN日志tab下面引用的是yahooLog.html 。真是见鬼了!有时候是好的有时候是坏的,这个问题困扰我很久,一直都没找到原因,请大家帮我看看,谢谢了!

解决方案 »

  1.   

    你提的问题 ,很可能是iframe缓存的问题,可以再点击方法开头执行content的清空动作
      

  2.   

    清空了 那之前打开的tab不就没了吗?这样不是我要的效果。
      

  3.   

    呵呵 偶也遇见了 每次关了再点 就好了可能是extjs加载顺序问题
      

  4.   

    给你一点我使用TreePanel的经验
    TreePanel的click事件默认是打开TreeNode的下级TreeNode
    所以我使用双击事件dblclickTreePanel.on('click', function(node, e){})
    node是当前点击的TreeNode,Id应该是字符型的TabPanel的add()方法,添加一个Panel
    如果TabPanel已经存在相同Id的Panel,则显示已存在的Panel,不是添加新的Panel