extjs gridpanel not showing scrollbars

17,553

You should set fit layout to Viewport:

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

Setting layout in GridPanel have no effect.

Share:
17,553
egerardus
Author by

egerardus

Updated on June 26, 2022

Comments

  • egerardus
    egerardus almost 2 years

    I am creating a page that only contains a gridpanel, I want my gridpanel to have scrollbars based on the browser size. To do this I am wrapping it in a viewport as discussed here and making sure I specify a layout as discussed here. The grid renders fine but I am not getting any scroll bars. I've tried 'fit', 'border' and 'anchor' layouts but still no luck. The code looks like this:

    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
            }],
        }]
    });
    
  • egerardus
    egerardus over 12 years
    Wow, thanks for that. Obviously I missed something in the Sencha posts.