1

我需要在过滤器菜单之外的列标题中添加一个按钮(如照片上的蓝色标记)

按钮蓝色标记在哪里

4

1 回答 1

1

像这样的小技巧可以奏效。只需让布局对齐以在 Container 的左右大部分部分显示内容。

Ext.create('Ext.container.Viewport', {
layout: 'fit',

items: [{
    xtype: 'container',
    items: [{
        xtype: 'grid',
        sortable: true,
        columns: [{
            flex: 1
        }, {
            text: "Age",
            flex: 1
        }],
        listeners: {
            afterrender: function (grid) {
                var columns = grid.columnManager.getColumns();
                var nameCol = columns[0];
                var targetDom = nameCol.textInnerEl.dom;
                var newPanel = Ext.create('Ext.container.Container', {
                    items: [{
                        xtype: 'label',
                        text: "Name"
                    }, {
                        xtype: 'button',
                        text: "DO IT"
                    }],
                    renderTo: targetDom
                   });
               }
           }
        }]
   }]
});

小提琴:https ://fiddle.sencha.com/#view/editor&fiddle/29o8

于 2017-11-16T10:52:58.203 回答