首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

请问一个extjs的有关问题!这有关问题很奇怪,希望大家帮小弟我看看

2012-05-27 
请教一个extjs的问题!这问题很奇怪,希望大家帮我看看!JScript codemsgTree.on(click, function(id) {if(

请教一个extjs的问题!这问题很奇怪,希望大家帮我看看!

JScript code
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 。真是见鬼了!有时候是好的有时候是坏的,这个问题困扰我很久,一直都没找到原因,请大家帮我看看,谢谢了!

[解决办法]
你提的问题 ,很可能是iframe缓存的问题,可以再点击方法开头执行content的清空动作
[解决办法]
呵呵 偶也遇见了 每次关了再点 就好了。。。可能是extjs加载顺序问题
[解决办法]
给你一点我使用TreePanel的经验
TreePanel的click事件默认是打开TreeNode的下级TreeNode
所以我使用双击事件dblclick

TreePanel.on('click', function(node, e){})
node是当前点击的TreeNode,Id应该是字符型的

TabPanel的add()方法,添加一个Panel
如果TabPanel已经存在相同Id的Panel,则显示已存在的Panel,不是添加新的Panel

热点排行