首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >tbar中的Extjs 5.1.3添加掩码/取消掩码网格的按钮

tbar中的Extjs 5.1.3添加掩码/取消掩码网格的按钮
EN

Stack Overflow用户
提问于 2022-10-21 07:59:05
回答 1查看 13关注 0票数 0

在Extjs中,我想在tbar图表中添加按钮,它隐藏/取消我的网格,我的布局有些困难,所以在确定的情况下,我的按钮占100%位置,还有我的网格显示,我的代码如下:

代码语言:javascript
复制
var barchart = {
    xtype: 'cartesian',
    legend: {
        docked: 'bottom'
    },
    tbar: [{
        xtype: 'container',
        layout: {
            type: 'vbox',
            columns: 1,
            align: 'stretch'
        },
        items: [{ 
            xtype: 'button', 
            text: 'Afficher DSO',
            listeners: {
                click: function(btn){
                    var dsoGrid = btn.nextSibling();

                    if( dsoGrid.hidden ){
                        helperCache.multiToolbox(dsoGrid, ["NOT_HIDE"]);
                        btn.setText("Masquer DSO");
                    } else {
                        helperCache.multiToolbox(dsoGrid, ["HIDE"]);
                        btn.setText("Afficher DSO");
                    }
                }
            }
        },{
            xtype: 'grid',
            itemId: 'grid_history_dso',
            // hidden: true,
            scrollable: 'x',
            margin: 5,
            flex: 1,
            store: dsoStore,
            columns: dsoColumns,
        }]
    }],
    .......

我喜欢我的按钮的大小是正常的,我的网格用x卷轴将他的容器的所有位置都安装好了。

EN

回答 1

Stack Overflow用户

发布于 2022-10-21 08:10:31

为了帮助同一案件中的任何人,我解决了我的问题:

代码语言:javascript
复制
var barchart = {
    xtype: 'cartesian',
    legend: {
        docked: 'bottom'
    },
    dockedItems: [{
        xtype: 'toolbar',
        dock: 'top',
        layout: {
            type: 'anchor',
        },
        items: [{ 
            xtype: 'button', 
            text: 'Afficher DSO',
            listeners: {
                click: function(btn){
                    var dsoGrid = btn.nextSibling();

                    if( dsoGrid.hidden ){
                        helperCache.multiToolbox(dsoGrid, ["NOT_HIDE"]);
                        btn.setText("Masquer DSO");
                    } else {
                        helperCache.multiToolbox(dsoGrid, ["HIDE"]);
                        btn.setText("Afficher DSO");
                    }
                }
            }
        },{
            xtype: 'grid',
            itemId: 'grid_history_dso',
            hidden: true,
            scrollable: 'x',
            margin: 5,
            anchor: '100%',
            store: dsoStore,
            columns: dsoColumns,
        }]
    }],

dockedItem是关键

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/74150472

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档