【问题标题】:How to Set Grid ExtJS on HTML body with 100% Height如何在 100% 高度的 HTML 正文上设置 Grid ExtJS
【发布时间】:2013-07-30 17:53:26
【问题描述】:


我正在使用 ExtJS Grid 来显示我的数据。
实际上,我想从一开始就全面展示我的网格。
但我不知道如何将高度设置为完全视图。我只能用像素设置高度(例如 600px、1024px 等)

这是我的html代码

<body style="background-color:#D9F4FF;height:600px"></body>

这是我的一些 ExtJS 代码

var grid = Ext.create('Ext.grid.Panel', {
    title: 'Export Report',
    border: false,
    flex:1,
    store: store,
    columns: [
            { header: "No.", xtype: 'rownumberer', width: 50, align: 'center' },
            { id: 'hawb', header: "HAWB", dataIndex: 'hawb', locked : true, width: 80, sortable: true, align: 'center'},
            { id: 'mawb', header: "MAWB", dataIndex: 'mawb', locked : true, width: 150, sortable: true, align: 'center'}
        ],
    loadMask: true,
    layout: 'border',
    height: '100%',
    width: '100%',
    dockedItems: [{
        xtype: 'pagingtoolbar',
        store: store, // same store GridPanel is using
        dock: 'bottom',
        displayInfo: true,
        items:[{
            itemId: 'filter',
            text: 'Filter',
            handler: function(){
                winFilter.show();
            }}]
    }],
    renderTo: Ext.getBody()
});

那么如何设置我的 ExtJS 和 HTML 代码以从我的浏览器显示全高视图 ExtJS。

提前致谢。

【问题讨论】:

    标签: html css extjs grid height


    【解决方案1】:

    您需要创建一个带有fit layoutViewPort 并将您的网格放入其中:

    Ext.widget('viewport', {
        layout: 'fit'
        ,items: [{
            xtype: 'grid'
            // ... your grid config
        }]
    });
    

    【讨论】:

    • 如果您不希望网格也占用视口宽度的 100%,您也可以使用其他布局,例如 hboxborder
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-03-02
    • 1970-01-01
    • 2015-08-05
    • 1970-01-01
    • 2011-08-27
    相关资源
    最近更新 更多