Layout: how to add above the Grid?
Filed Under mercialleasing.com |
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.
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
1) Use bbar (bottom) for the paging toolbar.
2) Nest the gridpanel inside another panel and use the "parent" panel's tbar.
#If you have any other info about this subject , Please add it free.# |