From: cfwild on
Hi,

I am pulling back a query that is populating a cfgrid cell with either a 1 or
a 2. Instead of the 1, I'd like the grid to display "No", instead of 2,
display "Yes".

If anyone has any thoughts on how to do this, I'd appreciate it!

cfwild

<cfgridcolumn name="I" header="Status" width="120" values="2,1"
valuesDisplay="Yes,No" />

From: paross1 on
You could do it in the query, rather than in the output. What database are you
using? Oracle has a DECODE() function specifically for changing one value to
another, and most databases will support using a CASE statement in the SELECT,
where you can perform conditional changes.

Phil

From: Jerrywall on
I'd just access the contents via Javascript and reformat them... using
something like this...



formatGrid = function() {
mygrid = ColdFusion.Grid.getGridObject('GridName');
cm.setRenderer(1,convert);
cm.setRenderer(2,convert);
cm = mygrid.getColumnModel();
mygrid.reconfigure(mygrid.getDataSource(),cm);
}

convert = function(data,cellmd,record,row,col,store) {
if (data == 1) return 'No';
else {
return 'Yes';}
}


<cfset ajaxOnLoad("formatGrid")>