日期:2014-05-16  浏览次数:20311 次

extjs tabpanel动态添加panel
index =  Ext.extend(Ext.Viewport,{
        center : new Ext.TabPanel({
		            id : 'mainview',
		            region : 'center',
		            activeTab : 0,
                    width : 600,
		            height : 250,
                    minTabWidth: 115,
                    tabWidth:135,
                    enableTabScroll:true,
		            split : true,
                    layoutOnTabChange:true,
                    tabPosition : 'top',
                    resizeTabs:true,
                    defaults : {autoScroll:true},
		            plugins : new Ext.ux.TabCloseMenu(),
		            items :{
		                id : 'start-panel',
					    title : 'MainView',
                        iconCls : 'tabs',
					    layout : 'fit',
					    bodyStyle : 'padding:25px',
					    html : '<img src="../images/bg.jpg"/>'
		            }
        }),
        constructor : function(){
            //var clock = new Ext.Toolbar.TextItem('');
            index.superclass.constructor.call(this,{
                layout : 'border',
                items : [{
                   region : 'north',
                   xtype : 'panel',
                   height : 25,
                   layout : 'column',
                   border : false,
                   items : [{
                        columnWidth : 1,
                        border : false,
                        layout : 'fit',
                        items : [{
                            xtype : 'panel',
                            id : 'logo-header',
                            border : false,
                            tbar : [
                                {
                                    text : currentUser
                                },{
                                    text : new Date().format('Y年m月d日')
                                },'->',{
                                    text:'注销'
                                    ,iconCls:'logout'
                                    ,handler:function(){
                                        Ext.Msg.show({
                                           title:'注销系统',
                                           msg: '提示:注销系统前请注意保存数据,确定要注销吗?',
                                           buttons: Ext.Msg.YESNO,
                                           fn: function(btn){
                                                if(btn=='yes'){
                                                    Ext.Ajax.request({
                                                       url : 'logout.action',
			                                           success : function() {
			                                                location = '../main/index.jsp';
			                                            },
			                                            failure : function() {
			                                                Ext.Msg.show({
			                                                    title : '错误提示',
			                                                    msg : '退出系统失败!',
			                                                    icon : Ext.Msg.ERROR,
			                                                    buttons : Ext.Msg.OK
			                                                });
			                                            }
                                                    });
                                                }
                                           }
                                        });
                                    }
                                }
                            ]
                        }]
                   }]
                },{
                    region : 'west',
                    xtype : 'panel',
                    layout : 'accordion',
                    title : '计划排产管理系统',
                    split : true,
                    minSize : 200,
                    maxSize : 250,
                    //margins : '2 0 5 5