PrasanthTR
PrasanthTR

Reputation: 29

Ext JS Grid Panel Height Property

I'm creating a grid using Ext JS. I need to increase the height of the grid panel automatically with the increase of the number of rows in the grid. Which property of Ext JS grid can be set to implement this?

Upvotes: 1

Views: 836

Answers (1)

ncardeli
ncardeli

Reputation: 3492

Just don't specify a value to the height property, and that's all.

Try it here: https://fiddle.sencha.com/#fiddle/bnl

Ext.create('Ext.data.Store', {
    storeId:'simpsonsStore',
    fields:['name', 'email', 'phone'],
    data:{'items':[
        { 'name': 'Lisa',  "email":"[email protected]",  "phone":"555-111-1224"  },
        { 'name': 'Bart',  "email":"[email protected]",  "phone":"555-222-1234" },
        { 'name': 'Homer', "email":"[email protected]",  "phone":"555-222-1244"  },
        { 'name': 'Marge', "email":"[email protected]", "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()
});

Upvotes: 2

Related Questions