【问题标题】:Ext JS Grid Panel Height PropertyExt JS 网格面板高度属性
【发布时间】:2014-10-13 15:36:45
【问题描述】:

我正在使用 Ext JS 创建一个网格。我需要随着网格中行数的增加自动增加网格面板的高度。可以设置 Ext JS 网格的哪个属性来实现这个?

【问题讨论】:

    标签: extjs grid


    【解决方案1】:

    只是不要为 height 属性指定值,仅此而已。

    在这里试试:https://fiddle.sencha.com/#fiddle/bnl

    Ext.create('Ext.data.Store', {
        storeId:'simpsonsStore',
        fields:['name', 'email', 'phone'],
        data:{'items':[
            { 'name': 'Lisa',  "email":"lisa@simpsons.com",  "phone":"555-111-1224"  },
            { 'name': 'Bart',  "email":"bart@simpsons.com",  "phone":"555-222-1234" },
            { 'name': 'Homer', "email":"home@simpsons.com",  "phone":"555-222-1244"  },
            { 'name': 'Marge', "email":"marge@simpsons.com", "phone":"555-222-1254"  }
        ]},
        proxy: {
            type: 'memory',
            reader: {
                type: 'json',
                root: 'items'
            }
        }
    });
    
    // Don't specify the height when creating the grid
    Ext.create('Ext.grid.Panel', {
        title: 'Simpsons',
        store: Ext.data.StoreManager.lookup('simpsonsStore'),
        columns: [
            { text: 'Name',  dataIndex: 'name' },
            { text: 'Email', dataIndex: 'email', flex: 1 },
            { text: 'Phone', dataIndex: 'phone' }
        ],
        width: 400,
        renderTo: Ext.getBody()
    });
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多