ExtJS GridPanel不能显示滚动条。

4
我正在创建一个仅包含网格面板的页面,我希望我的网格面板可以根据浏览器大小拥有滚动条。为此,我将其包装在视口中,如这里所讨论的那样,并确保我指定了像这里所讨论的布局。网格正常渲染,但我没有得到任何滚动条。我尝试过“fit”、“border”和“anchor”布局,但还是没有成功。代码如下:
Ext.create('Ext.Viewport', {
    items: [{
        region: 'center',
        layout: 'fit',
        xtype: 'gridpanel',
        store: myStore,
        loadMask: true,      
        columns: [{
            header: 'Account ID',
            dataIndex: 'acct_id',
            width: 70
        }, {
            header: 'First Name',
            dataIndex: 'first_name',
            width: 120
        }, {
            header: 'Last Name',
            dataIndex: 'last_name',
            width: 120
        }, {
            xtype: 'numbercolumn',
            header: 'Account Balance',
            dataIndex: 'acct_bal',
            width: 70,
            renderer: Ext.util.Format.usMoney
        }, {
            xtype: 'numbercolumn',
            header: 'Credit',
            dataIndex: 'credit',
            width: 70,
            renderer: Ext.util.Format.usMoney
        }, {
            xtype: 'numbercolumn',
            header: 'Debt',
            dataIndex: 'debt_bal',
            width: 70,
            renderer: Ext.util.Format.usMoney
        }],
    }]
});
1个回答

10

你应该将布局的fit属性设置为Viewport

Ext.create('Ext.Viewport', {
    layout: 'fit',
    items: [...]
});

GridPanel中设置布局没有效果。


哇,谢谢你。显然我在 Sencha 的帖子中漏掉了一些东西。 - egerardus

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接