Sencha touch 为什么工具栏不会因模式消息而变灰?

Sencha touch 为什么工具栏不会因模式消息而变灰?,sencha-touch,Sencha Touch,假设我在Sencha Touch 2应用程序的启动功能中有这段代码 var toolbar = { xtype: 'toolbar', items: [ { text: 'Show message', listeners: { tap: function() { Ext.Msg.alert('', 'Some message');

假设我在Sencha Touch 2应用程序的启动功能中有这段代码

var toolbar = {
    xtype: 'toolbar',
    items: [
        {
            text: 'Show message',
            listeners: {
                tap: function() {
                    Ext.Msg.alert('', 'Some message');
                }
            }
        }
    ],
    docked: 'top'
};

var main = {
    xtype: 'component'
};

Ext.Viewport.add([toolbar, main]);

为什么单击“显示消息”时显示的消息也不会使停靠的工具栏变灰?

工具栏应该是
main
的子工具栏,而不是视口的子工具栏,以便包含在模式对话框掩码后面
main
也应该是
面板的一个实例。例如:

    ...
    var main = {
        xtype: 'panel',
        items: [toolbar]
    };

    Ext.Viewport.add(main);

这里有一把Sencha小提琴,它展示了正确的行为:

谢谢你的回答。这很好用。你能告诉我为什么我们需要使用面板吗?我试过使用容器,看起来效果也不错。我认为当我们需要显示弹出窗口时应该使用面板。@emanuele是的,容器可以正常工作。使用适合您的应用程序的任何东西。