Layout: how to add above the Grid?

Filed Under mercialleasing.com |

  • Hello,

    what is the correct way to add some buttons above the GridPanel? Currently I'm creating something like this:


    var grid = new Ext.grid.GridPanel({...});
    var buttons = new Ext.Panel ({
    xtype: 'panel',
    buttonAlign: 'left',
    buttons: [ { text: 'some button', handler: function() {} }, { text: 'another button', handler: function() {} } ],
    bodyStyle: "padding:12px;"
    });
    var panel = new Ext.Panel ({
    xtype: 'panel',
    items: [ buttons, grid ]
    });


    But it seems like a bit overkill. Is there any other way to add buttons in the panel header?

    Thanks in advance.


  • Hi,

    Use "tbar" config:


    var grid = new Ext.grid.GridPanel({
    tbar : [{
    text : 'some button',
    handler : function(button, e){
    // do something
    }
    }, {
    text : 'another button',
    handler : function(button, e){
    // do something else
    }
    }]
    });


    Documentation : http://extjs.com/deploy/dev/docs/?class=Ext.grid.GridPanel&member=tbar

    tbar config is available on all panels afaik. Also check out the bbar config option.

    Cheers,
    Joshua


  • Two thoughts:
    1) Use bbar (bottom) for the paging toolbar.
    2) Nest the gridpanel inside another panel and use the "parent" panel's tbar.


  • Unfortunately, tbar is already taken by grid's paging toolbar .


  • You should be able to use two toolbars. See example here: http://gridsearch.extjs.eu/







  • #If you have any other info about this subject , Please add it free.#
    Your name:
    E-mail:
    Telphone:

    Your comments:


    If you have any other info about Layout: how to add above the Grid? , Please add it free.

    Comments