如何修复 Extjs 4.2 中的表头

F4k*_*k3d 2 grid header fixed extjs4.2

我想在我的 ExtJs 4.2 应用程序中修复我的表格/网格标题,以便在滚动时标题始终可见。我的应用程序中的主网格有一个固定的标题,并按照本文底部的代码实现。它不起作用,我不知道为什么......我用 split 属性尝试过它,但它也不起作用...... :(

这是代码:

function openThePopup() {
var win = new Ext.Window({
    modal : true,
    height : 500,
    width : 900,
    plain : true,
    border : false,
    resizable : false,
    maximizable : false,
    draggable : true,
    closable : true,
    closeAction : 'destroy',
    title : 'Title',
    autoScroll : true,
    buttonAlign : 'center',
    items : [ {
        xtype : 'grid',
        id : 'theGrid',
        store : theStore,
        border : 0,
        layout : 'fit',
        margins : '5 0 0 0',
        split : true,
        columns : [ {
            text : 'Country',
            dataIndex : 'country'
        }, {
            text : 'City',
            dataIndex : 'city'
        }, {
            text : 'ZIP',
            dataIndex : 'zip'
        }, {
            text : 'Street',
            dataIndex : 'street',
            width : 200
        }, {
            text : location,
            dataIndex : 'name',
            width : 200
        } ],
        listeners : {
            itemdblclick : function(t, record, item, index, e, eOpts) {
                ...
            }
        }
    } ],
    buttons : [ {
        onClick : function() {
            ...
        }
    } ]
}).show();
}
Run Code Online (Sandbox Code Playgroud)

我感谢任何帮助。

非常感谢您提前。

向你们所有人致以最良好的祝愿。

Eva*_*oli 5

您的布局配置不正确。本layout: 'fit'应该在窗口和布局配置应该从网格中删除。还要删除autoScroll窗口上的配置。