简体   繁体   English

如何完全隐藏 dockedItems 工具栏

[英]How to completely hide the dockedItems toolbar

I'm able to hide items among the dockedItems of a TabPanel, but am wanting to temporarily hide the entire dock, because the toolbar itself still takes up space and the rest of the content does not fill the screen.我可以在 TabPanel 的停靠项中隐藏项目,但我想暂时隐藏整个停靠栏,因为工具栏本身仍然占用空间,并且内容的 rest 不会填满屏幕。

So far, I do like so:到目前为止,我确实喜欢这样:

myApp.views.productList.dockedItems.items[0].removeAll(true);
myApp.views.productList.doComponentLayout();

Alternatively:或者:

myApp.views.productList.getComponent('search').removeAll(true);
myApp.views.productList.doComponentLayout();

But neither removes the dockedItems toolbar itself.但两者都不会删除 dockedItems 工具栏本身。

I've even tried to give the dockedItems individually and collectively an id: to remove the whole component, but without luck.我什至尝试单独和集体地给 dockedItems 一个id:以删除整个组件,但没有运气。 I've also tried moving the toolbar in question out from the docked items and into the items: property of the containing panel, but this breaks other things in my app that I'd rather not change at present.我还尝试将有问题的工具栏从停靠的项目中移出并移到包含面板的items:属性中,但这会破坏我的应用程序中我目前不想更改的其他内容。

Any clues on how to do this?关于如何做到这一点的任何线索?

If I understand you correctly you want to temporally remove tabBar from a tabPanel.如果我理解正确,您想暂时从 tabPanel 中删除 tabBar。 I was able to accomplish this through giving and id to my tabBar and then using removeDocked and addDocked methods.我能够通过给我的 tabBar 和 id 来实现这一点,然后使用 removeDocked 和 addDocked 方法。 I'm new to sencha-touch so most likely there is a better way of doing this我是 sencha-touch 的新手,所以很可能有更好的方法来做到这一点

The code below removes tabBar from tabPanel and then adds it back again.下面的代码从 tabPanel 中删除了 tabBar,然后再次将其添加回来。

Ext.setup({

onReady: function() {

    var tabpanel = new Ext.TabPanel({

        ui        : 'dark',
        sortable  : true,
        tabBar:{
            id: 'tabPanelTabBar'
        },
        items: [
            {title: 'Tab 1',html : '1',cls  : 'card1'},
            {title: 'Tab 2',html : '2',cls  : 'card2'},
            {title: 'Tab 3',html : '3',cls  : 'card3'}
        ]
    });

    var paneltest = new Ext.Panel({
        fullscreen: true,
        dockedItems:[
            {

                xtype: 'button',
                text: 'Disable TabBar',
                scope: this,
                hasDisabled: false,
                handler: function(btn) {

                    console.log(btn);
                    if (btn.hasDisabled) {

                        tabpanel.addDocked(Ext.getCmp('tabPanelTabBar'), 0);

                        btn.hasDisabled = false;
                        btn.setText('Disable TabBar');
                    } else {

                        tabpanel.removeDocked(Ext.getCmp('tabPanelTabBar'), false)

                        btn.hasDisabled = true;
                        btn.setText('Enable TabBar');
                    }
                }}
        ],
        items:[tabpanel]
    });
    paneltest.show()
}

}) })

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM