首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >将工具栏添加到网格中,并将其位置设置在Ext.grid.GridPanel的tbar上方

将工具栏添加到网格中,并将其位置设置在Ext.grid.GridPanel的tbar上方
EN

Stack Overflow用户
提问于 2016-05-26 10:01:57
回答 1查看 1K关注 0票数 0

我有一个grid

代码语言:javascript
复制
ProjectListReportGrid = Ext.extend(Ext.grid.GridPanel, {
    iconCls: 'silk-grid',
    id: 'consolidatedReportGrid',
    frame: false,
    title: 'Project Team Reports[Team Summary Report]',
    initComponent: function () {

        this.viewConfig = {
            forceFit: true
        };

        this.tbar = this.buildBottomToolbar();
        ProjectListReportGrid.superclass.initComponent
            .call(this);
    },
    buildBottomToolbar: function () {
        teamSummaryReportButton = new Ext.Button({
            iconCls: 'teamsummaryreport',
            handler: this.onAdd,
            scope: this,
            name: 'Summary'
        });
    }
});

我将一个新的toolbar添加到grid之上,如下所示:

代码语言:javascript
复制
consolidatedReportGrid.add(new Ext.Toolbar({
    width: 1300,
    id: 'remove',
    buttonAlign: 'center',
    tabPosition: 'top',
    items: [myRadioGroup]
}));

我想把它的位置定在最上面,但它低于tbar of gridpanel

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-05-26 10:38:07

For ExtJS3

使用insert()而不是add(),如下所示:

代码语言:javascript
复制
grid.getTopToolbar().insert(0, new Ext.Toolbar({
    items: [
        new Ext.Button({
            text: 'Added button'
        })
    ]
}));

工作小提琴

For ExtJS4+

使用addDocked()而不是add(),如下所示:

代码语言:javascript
复制
grid.addDocked(new Ext.Toolbar({
    items: [
        {
            xtype: 'button',
            text: 'Test add docked'
        }
    ]
}), 0);

工作小提琴

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

https://stackoverflow.com/questions/37457564

复制
相关文章

相似问题

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