View Full Version : How to change Header

9 Nov 2009, 11:42 PM
Is there anyway to change Header in a grid according to the button which we click in a list

10 Nov 2009, 12:06 AM
use Ext.grid.ColumModel's setColumnHeader (http://www.extjs.com/deploy/ext-3.0.0/docs/?class=Ext.grid.ColumnModel&member=setColumnHeader) for that, i.e.

var cm = grid.getColumnModel();
cm.setColumnHeader( cm.getColumnById('columnid'), 'New Header' );

Selecting the actual value for 'New Header' from a combo or a number of buttons in the select event or click handler should be straight forward.

10 Nov 2009, 1:37 AM
Am unable to get this.This is my colum model.i want to change the header:'Campaign Start Date' as header:'Campaign End Date' and also header:'Actual Posting Date' as header:'Actual Removing Date' when i click a button.can you please help me.:((

postingreportDataModel = new Ext.grid.ColumnModel([
new Ext.grid.RowNumberer(),chkboxOpp,
{header:'Media Code',dataIndex:'siteno',sortable:true},
{header:'Campaign Start Date',dataIndex:'Add_Remove_Date',name:'Add_Remove_Date',id:'Add_Remove_Date',sortable:true,renderer:Ext.util.Format.dateRenderer('d-M-Y')} ,
{header:'Actual Posting Date',dataIndex:'actualpostingdate',renderer:Ext.util.Format.dateRenderer('d-M-Y'),sortable:true,
editor: new Ext.form.DateField({name:'actualpostingdate',id:'actualpostingdate' })



10 Nov 2009, 2:27 AM
You should assign each column an individual id, then it should work.