Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

extjs gridpanel not showing scrollbars

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
        }],
    }]
});
like image 548
egerardus Avatar asked Dec 27 '22 07:12

egerardus


1 Answers

You should set fit layout to Viewport:

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

Setting layout in GridPanel have no effect.

like image 85
Krzysztof Avatar answered Jan 12 '23 23:01

Krzysztof