ITeye博客

关于tree与tab的诡异问题

galo · 2010-10-19 16:48 · 产品发布 · Web前端 · Markdown

  1. 平时看的好多网站没地方存,存浏览器我去了外地没办法看。所以最近在使用ext+gae开发一个网址收藏夹的站点。 这里必须发出站点大家才能看到我的问题,有人觉得广告请见谅:http://www.galo.tk,问题在于比如光荣墙上有一位会员,我双击即可查看他(她)的收藏,即tab增加一个panel,当我关闭这个panel之后,再新开一个panel,或者看已经存在的panel,发现内容居然是已经关掉的他(她)的收藏,只是标题正确,里面的内容完全错位. 点击帮助中心中的菜单,关了再开,再关,多试几次也可以发现问题所在。我很纳闷,特与大家分享! 贴出关键代码: 切换tab的方法如下:

tabAddPanel:function(tabName){
        if(!_centerTabP.getItem(tabName))
        {
          var _centerP = Ext.getCmp(tabName);
          _centerTabP.add(_centerP).show();
        }
		_centerTabP.setActiveTab(tabName);
        _centerTabP.doLayout(); 
	}

树的操作方法:


userHelpTree.on("click",function(node){
		
		var cmd = node.text;
		main.extAlert("您点击了【"+cmd+"】");
		if(cmd == '修改资料'){
			
		}else if(cmd == '寻找网址'){
			main.tabAddPanel("centerP_4");
		}else if(cmd == '道具商城'){
			main.tabAddPanel("centerP_5");
		}else if(cmd == '反馈留言'){
			main.tabAddPanel("centerP_6");
		}else if(cmd == '本站之最'){
			main.tabAddPanel("centerP_7");
		}else if(cmd == "开发日记"){
			main.tabAddPanel("centerP_8");
		}else if(cmd == "帮助中心"){
			main.tabAddPanel("centerP_9");
		}else{
			main.extAlert("杯具,哪里出错了!");
		}
	});

tab面板的定义:


var centerTabP = new Ext.TabPanel({
		id:'centerTabP',
		autoDestroy:false,
		autoTabs:true,
		enableTabScroll:true ,
		activeItem:0,
   		//如果Tab过多会出现滚动条
     	enableTabScroll:true,
    	//加载时渲染所有
    	//deferredRender:false,
     	closeAction:'hide',
     	layoutOnTabChange:true
	});

tab其中一个定义(大致都差不多):


var centerP_1 = new Ext.Panel({
	
		id:'centerP_1',
		title:'光荣墙',
		layout:'fit',
		contentEl:'centerP_1_div'
	});

当点击树时切换不同的面板,大家试试即可发现问题的诡异。 :cry:

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。