为什么那个总是有两个 tabpanel了、、

   
      
  Ext.onReady(function(){ 
    var panel; 
  var viewport=new Ext.Viewport({
  layout:'border',
  items:[{
  region:'north',
  height:60              
  },{
  region:'west',
                    id:'west',
                    title:'',
                    split:true,
                    width: 150,
                    minSize: 175,
                    maxSize: 400,
                    collapsible: false,
                    margins:'0 0 0 2',
                    layout:'accordion',
                    layoutConfig:{
                        animate:true
                    },
  items:westItems
  },{
  region:'center',                   
                    title:'',
                    split:true,
                    width: 200,
                    minSize: 175,
                    maxSize: 400,
                    collapsible: false,
                    margins:'0 0 0 2',
                    layout:'accordion',
                    layoutConfig:{
                        animate:true
                    },
  items:tabPanel
  } ]
                })
                var panel = new Ext.Panel({
                id:'main-panel',
                baseCls:'x-plain',
                renderTo: Ext.get("center"),
                layout:'table',
                layoutConfig: {columns:2},
                defaults: {frame:true, width:395, height: 300}           
            });

  });


      var tabPanel=new Ext.TabPanel({
                id:"tabPanel",
                   region:'center',
                   deferredRender:false,                 
                   iconCls: 'tabs',
                   items:[{
                       contentEl:'center',                     
                       autoScroll:true
                   }]
          }); 
    function onClickMenuItem(el){    
    updateTab(el.id,el.innerHTML,el.href);
    }
       
    function addTab(id,tabTitle, targetUrl){
        tabPanel.add({
        id:id,
    title: tabTitle,
    iconCls: 'tabs',
    autoLoad: {url: "tabFrame.jsp?url="+targetUrl},
    closable:true
}).show();
    }
   
    function updateTab(id,title, url) {
    var tab = tabPanel.getItem(id);            
    if(tab){    
    tabPanel.remove(tab);
    }
    tab = addTab(id,title,url);
    tabPanel.setActiveTab(tab);
    }

你可能感兴趣的:(jsp,ext)