0

我想将面板添加到 tabPanel 的选项卡之一,我对面板使用边框布局,但是当我将面板添加到选项卡时,它无法填充它的父正文。
面板代码:

var viewport = Ext.create('Ext.panel.Panel', {
layout: {
type: 'border',
padding: 5
},
defaults: {
split: true,
anchor:'100%'
},
id:'viewPort',
width:600,
height:600,
items: [{
region: 'west',
collapsible: true,
title: 'Starts at width 30%',
split: true,
width: '17%',
minWidth: 100,
minHeight: 140,
layout:{
type:'vbox',
align:'stretch'
},
items: [show,treePanel,propGrid]
},tabs]
});

作为面板父级的选项卡代码,当用户单击它时面板会动态加载到它:

var mainTabs = Ext.create('Ext.tab.Panel', {
layout: 'anchor',
id:'mtabs',
defaults: {
split: true,
anchor: '100%'
},
items: [{
title: 'Layout Window',
closeAction: 'hide',
layout: {
type: 'border',
padding: 5
},
//anchor: '100%',
width:600,
height:600,
listeners: {
    activate:function (tab) {

    }
},
items: [{
    region: 'west',
    collapsible: true,
    title: 'Starts at width 30%',
    split: true,
    width: '17%',
    minWidth: 100,
    minHeight: 140,
    layout:'vbox',
    items: [historyTreePanel,propGrid]
    },tabs]
},{
    title: 'History',
    //xtype:'panel',
    width:2000,
    height:1024,
    html: 'Please Wait...',
    id:'history-tab',
    layout:'fit',
    layout: 'hbox',
     default: {
     anchor:'100%'
     },
//iconCls: 'favorites',
//cls: 'card1',
listeners: {
    activate:function (tab) {
    if(!flag){
    flag = true;
        $.getScript("/FleetManagement/js/history/fleethistory.js", function(data, textStatus, jqxhr) {
            Ext.getCmp('history-tab').add(viewport);
        });
}
}
}
}],
renderTo : Ext.getBody()
});
});

在上面的代码选项卡中,id:'history-tab'是我提到的选项卡。我该如何解决这个问题?
标签内容

4

1 回答 1

1

您的代码似乎缺少一些组件。您的标签应该有正确的布局。示例代码。jsfiddle 示例在这里。希望这可以帮助

Ext.onReady(function() { var resultsPanel = Ext.create('Ext.Panel',{
        frame:false,
        border:false,
        collapsible:false,
    title:'tab main',
        layout:'border',
        items:[{
          region: 'center', 
          id:'centerPanel',
            title:'center',
          xtype:'panel',
          layout:'fit',
          border: true,
          items:[{id:'grid',xtype:'panel'}]

        },

               {
                 region: 'west',     
                 id:'westPanel',
                   title:'facets',
                 xtype:'panel',
                 width:'15%',
                 collapseMode: 'mini',
                 collapsible:true,
                 autoScroll: true,
                 border: false,
                 baseCls:'x-plain',
                 split: true ,
                 items:[{id:'facet',xtype:'panel'}]
               }
              ]
      }); var subtab = {  xtype:'tabpanel',
                      title:'moretabs',
                      activeTab: 0,//tabActive,
                      closable:true,
                      border:false,
                      id:'idd',
                items: [{border:false,layout: 'fit',cls: 'inner-tab-custom', autoShow:true, id:'sub1-',title:  'nested1',items:[resultsPanel]}]  };

var tabPanel = Ext.create('Ext.tab.Panel', {
      layout:'fit',
    height:200,
      msgDisplay: 'block',
      //deferredRender:false,
      border:false,
      items: [subtab]
      }).render(Ext.getBody());

});
于 2012-12-19T05:50:45.750 回答