PDA

View Full Version : change background color of datagrid row from a specified value



babsevensix
28 Aug 2007, 5:33 AM
How Can I change background color of a Datagrid row?

Animal
28 Aug 2007, 5:34 AM
Implement this in your GridView:

http://extjs.com/deploy/ext/docs/output/Ext.grid.GridView.html#getRowClass

jay@moduscreate.com
28 Aug 2007, 5:47 AM
gridView = new Ext.grid.GridView({
getRowClass : function (row, index) {
var cls = '';
var data = row.data;
switch (data.SEVERITY) {
case 'C' :
cls = 'caqDataGridCritical'
break;
case 'M' :
cls = 'caqDataGridMinor'
break;
case 'W' :
cls = 'caqDataGridWarning'
break;
case 'H' :
cls = 'caqDataGridHarmless'
break;
}
return cls;
}
});

grid = new Ext.grid.Grid('grid', {
ds: ds,
cm: cm,
//selModel: new Ext.grid.RowSelectionModel({singleSelect:true}),
enableColLock:false,
autoExpandColumn: 'atext',
monitorWindowResize : true,
loadMask: true,
view: gridView
});

ByteLess
22 Oct 2007, 11:33 AM
how can I acheive the same in coldfusion?

tryanDLS
22 Oct 2007, 1:10 PM
Um...Ext is a clientside Javascript library. You need to to write your own server code in whatever language you choose to send the data to the browser. http://extjs.com/learn

jay@moduscreate.com
22 Oct 2007, 2:39 PM
^^^ CF has some shortcut functions though. This is why i dislike super high level things like that. I feel the same way about ruby.

huangfengjing
22 Oct 2007, 10:49 PM
Cool, does the SEVERITY is the record property returned by server?

jay@moduscreate.com
23 Oct 2007, 3:12 AM
yes. you can use any property :)