Extjs4,如何更新窗口bbar(工具栏)?

Extjs4,如何更新窗口bbar(工具栏)?,extjs4,Extjs4,我想动态更新Extjs窗口bbar(工具栏),但我不知道该如何让它工作 示例代码: var myWin = Ext.create('Ext.window.Window', { modal: true, layout: 'fit', items: { // panel }, bbar: ['->', { xtype: 'buttongroup', items: [{ text: 'Cancel',

我想动态更新Extjs窗口bbar(工具栏),但我不知道该如何让它工作

示例代码:

var myWin = Ext.create('Ext.window.Window', {
    modal: true,
    layout: 'fit',
    items: {
    // panel
    },
    bbar: ['->', {
    xtype: 'buttongroup',
    items: [{
        text: 'Cancel',
        handler: function () {
        invoicingWin.destroy();
        }
    }]
    }, {
    xtype: 'buttongroup',
    items: [{
        text: 'Continue',
        handler: function () {

        var test = new Ext.Toolbar({
            dock: 'bottom',
            items: ['->', { html: "Close"}]
        });

        //  !! I want to replace this window bbar to test(toolbar)

        } // btn handler
    }]// items
    }]
}).show();
任何人都知道,请帮助我


谢谢大家!

IMO,ExtJS不希望替换面板的工具栏(以及面板的后代)。通常情况下,工具栏将包含所需项目的列表,您只需隐藏/显示它们


实际上,您仍然可以使用
getDockedItems()
getDockedComponent()
addDocked()
insertDocked()
removeDocked()
来满足您的需求。

我认为这不是一个好的解决方案。但它会起作用

var myWin = Ext.create('Ext.window.Window', {
    modal: true,
    layout: 'fit',
    width:400,
    height:400,
    items: {
    // panel
    },
    bbar: ['->', { 
    xtype: 'buttongroup',
    items: [{
        text: 'Cancel',
        handler: function () {
        invoicingWin.destroy();
        }
    }]
    }, {
    xtype: 'buttongroup',
    items: [{
        text: 'Continue',
        handler: function () {

        var test = new Ext.Toolbar({
            dock: 'bottom',
            items: ['->', { html: "Close"}]
        });
        myWin.removeDocked(myWin.down('toolbar'));
        myWin.addDocked(test);
        //  !! I want to replace this window bbar to test(toolbar)

        } // btn handler
    }]// items
    }]
}).show();

很难理解你想要什么?您想在单击按钮时用工具栏替换bbar吗?