PDA

View Full Version : Adding buttons to Grid toolbar



ext_user1
22 Apr 2010, 12:06 PM
Hi
I was trying to simulate the following code to a Grid toolbar.



//Create the Download button and add it to the top toolbar
var exportButton = new Ext.ux.Exporter.Button({
component: grid,
text : "Download as .xls"
});

grid.getTopToolbar().add(exportButton);
how to that button into following code.



llayout: 'fit',
items:
new Ext.grid.GridPanel({
id: 'grid1',
border:false,
store: ds1,
cm: new Ext.grid.ColumnModel([
new Ext.grid.RowNumberer(),
{header: "Id", width: 25, sortable: true, dataIndex: 'project_id'},
{header: "Project", width: 70, sortable: true, dataIndex: 'project_title'},
]),

viewConfig: {
forceFit:true
},


fbar: [{ //????? how to create toolbar button here?
text: 'test',
ref: 'exportButton'
}]

how to do that?

CrazyEnigma
23 Apr 2010, 6:30 AM
var exportButton = new ...
new Ext.grid.GridPanel({...
fbar: [exportButton],
...
});


toolbars accepts an Ext Object, lazy object instantiation to Buttons, and reserved keyword text like '-' for separator.

23 Apr 2010, 7:05 AM
The common way to do it is "buttons" not "fbar"