PDA

View Full Version : Button in Grid cell



tomalex0
23 Apr 2009, 11:36 PM
Hi i'm showing a grid in window which is fetching value from Db, i have to implement a button in grid coloumn ( header download) ie mentioned below, the grid is list of files that can be downloaded, so how can i render a button in a cell.


this.columnModel = new Ext.grid.ColumnModel([new Ext.grid.RowNumberer(), {
header: 'ID',
readOnly: true,
dataIndex: 'Id',
width: 60,
hidden: true
},
{
header: 'Name',
readOnly: true,
dataIndex: 'name',
width: 250,
hidden: false
},
{
header: 'Download',
readOnly: true,
dataIndex: 'details',
width: 100,
hidden: false
//button should go here
}]);

bt_bruno
24 Apr 2009, 2:49 AM
You can put an image and listen to the cellclick event on grid to determine the action.



renderer: function()
{
return '<img src="'+Ext.BLANK_IMAGE_URL+'" class="ico_download" />'
}




cellclick : function( grid, rowIndex, columnIndex, e )
{
var dataIndex = grid.getColumnModel().getDataIndex();

if( dataIndex === 'details')
{
//TODO: download rotine
}
}

tomalex0
28 Apr 2009, 8:52 PM
thx for the helpful tip from u

tomalex0
6 May 2009, 4:11 AM
I have found method of rendering button in grid cell , you can find out it in the below mentioned link

http://extjs.com/forum/showthread.php?p=213769