PDA

View Full Version : [Solved] change a grid header on the fly



michaelc
5 Nov 2009, 4:40 PM
this should be simple, but I don't see it.

I have a grid that will load another grid, when you click a row I want the column header for another grid to be set to the selected value.

SO how would I set the Column header.



// device Grid uses class store
var gridDevice = new Ext.grid.GridPanel({
store : storeDevice,
footer : true,
id : "EAdminDistributionManager-device-grid",
columns : [{
header : this.deviceLit,
width : gridWidth,
dataIndex : 'jobFileName',
sortable : true,
renderer : function(v, p) {
// v : value , p : cell
p.attr = 'ext:qtitle="' + EAdminDistributionManager.classInfo + v + '"';
p.attr += ' ext:qtip=" "';
return v;
}
}],
height : gridHeight

});
. . . . . . . .
selectTool : function(grid, rowIndex, columnIndex, event) {
var data = grid.getStore().getAt(rowIndex).get('deviceName');
var gridDevice = Ext.getCmp('EAdminDistributionManager-device-grid');
gridDevice.store.baseParams.device = data
QoDesk.EAdminDistributionManager.prototype.deviceLit = data;
gridDevice.store.reload();
}

evant
5 Nov 2009, 4:47 PM
http://www.extjs.com/deploy/dev/docs/?class=Ext.grid.ColumnModel&member=setColumnHeader

uniring
5 Nov 2009, 4:49 PM
I think what you need is this (http://www.extjs.com/deploy/dev/docs/?class=Ext.grid.GridView&member=getHeaderCell).

Evant wins.

michaelc
6 Nov 2009, 9:51 AM
http://www.extjs.com/deploy/dev/docs/?class=Ext.grid.ColumnModel&member=setColumnHeader

Thanks . . . took a minute to think it through as I had not defined a column model.



selectTool : function(grid, rowIndex, columnIndex, event) {
var data = grid.getStore().getAt(rowIndex).get('deviceName');
var gridDevice = Ext.getCmp('EAdminDistributionManager-device-grid');
gridDevice.store.baseParams.device = data;
gridDevice.colModel.setColumnHeader(0,data);
QoDesk.EAdminDistributionManager.prototype.deviceLit = data;
gridDevice.store.reload();
}