Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding a toolbar to a grid - Extjs

I have the following grid here:

Ext.define('AM.view.user.List', {
    extend: 'Ext.grid.Panel',
    alias: 'widget.userlist',
    title: 'All Users',
    store: 'Users',

    initComponent: function () {
        this.columns = [{
            header: 'Name',
            dataIndex: 'name',
            flex: 4
        }, {
            header: 'User ID',
            dataIndex: 'user_id',
            flex: 1
        }, {
            header: 'Address',
            dataIndex: 'address',
            flex: 3
        }, {
            header: 'Age',
            dataIndex: 'agee',
            flex: 5
        }];

        this.callParent(arguments);
    }
});

Can a toolbar be added to the bottom of this grid or can they only be added to panels?

Also, how can I place normal text in a toolbar rather than a button?

like image 874
Clay Banks Avatar asked Nov 29 '22 12:11

Clay Banks


1 Answers

Yes a grid panel inherits Ext.grid.Panel, you should be able to add:

dockedItems: [{
    xtype: 'toolbar',
    dock: 'top',
    items: [{
        xtype: 'button',
        text: 'Left Button'
    }, {
        xtype: 'tbfill'
    }, {
        xtype: 'button',
        text: 'Right Button'
    }]
}]
like image 82
BigBadOwl Avatar answered Dec 04 '22 12:12

BigBadOwl