如题

解决方案 »

  1.   

    var panel = new Ext.Panel({
    title: '标题',
    width: 400,
    height: 400,
    renderTo: Ext.getBody(),
    collapsible: true, // 折叠
    titleCollapse: true, // 点标题栏可折叠
    buttonAlign: 'center', // right/left
    //html: '<h1>主题内容</h1>',
    contentEl: 'content',
    bbar:[
    new Ext.Toolbar.Button({
    text: '文件',
    handler: function(){
    Ext.Msg.alert('提示', '哈哈');
    }
    }),
    new Ext.Toolbar.Separator(),
    new Ext.Toolbar.Spacer(),
    {
    text: '文件2',
    handler: function(){
    Ext.Msg.alert('提示', '哈哈');
    }
    },
    new Ext.Toolbar.TextItem({
    text: '文本信息'
    }),
    new Ext.Toolbar.Fill(),
    new Ext.Toolbar.SplitButton({
    text: '编辑',
    menu: [
    {
    text: '复制'
    },
    {
    text: '粘贴'
    }
    ]
    })
    ],
    buttons:[
    {
    text: '提交',
    handler: function(){

    }
    },
    {
    text: '提交2'
    }
    ]
    });
      

  2.   

    我理解楼主是想把button放到panel中的items里,楼上的方法button是在最底下的。如果放到items里就行了:
    button1 = new Ext.Button(
        {
         ......
         }var panel = new Ext.Panel({
    ......
    items: [
        ......
        {
        button1
        }
    });