ExtJS TabPanel在ViewPort中缺少滚动条

时间:2009-07-17 18:15:09

标签: javascript extjs

我有一个ViewPort,我想打开一些标签。我的一个标签很长,应该从页面底部开始。但是,侧面缺少滚动条。

这是我的视口设置:

var viewport = new Ext.Viewport({
    layout:'border',
    enableTabScroll:true,
    deferredRender:true,
    items:[
        new Ext.BoxComponent({ // raw
            region:'north',
            el: 'north',
            height:32
        }),{
            region:'west',
            id:'west-panel',
            title:'West',
            split:true,
            width: 200,
            minSize: 175,
            maxSize: 400,
            collapsible: false,
            margins:'0 0 0 5',
            layout:'accordion',
            deferredRender: true,
            layoutConfig:{
                animate:true
            },
            items: [{
                contentEl: 'west',
                title:'Navigation',
                border:false,
                collapsible: false,
                iconCls:'nav'
            }]
        },
        new Ext.TabPanel({
            region:'center',
            id:'center',
            activeTab:0,
            items:[{
                contentEl:'center1',
                title: 'Close Me',
                closable:true,
                layout:'fit',
                autoScroll:true
            }]
        })
     ]
});

这是我的添加标签代码:

Ext.get("addplace").on('click', function() {
    centerTabs = Ext.getCmp('center');
    tab = centerTabs.add(new Ext.TabPanel({
        iconCls: 'tabs',
        id: 'add_place_tab',
        autoLoad: {url: '/admin/addplace', scripts : true,},
        title: 'Add Place',
        loadMask: false,
        closable:true
    }));
    centerTabs.setActiveTab(tab);
});

提前致谢!

1 个答案:

答案 0 :(得分:14)

在热门代码中,尝试将autoScroll属性设置为true

new Ext.TabPanel({
    region:'center',
    id:'center',
    activeTab:0,
    defaults:{ autoScroll:true }, // here
    items:[{
        contentEl:'center1',
        title: 'Close Me',
        closable:true,
        layout:'fit',
        autoScroll:true
    }]
})

这样,您稍后添加的所有标签都会autoScroll自动设置为true