Access the answers to your technology questions today.
Subscribe Now
30-day free trial. Register in 60 seconds.
What Makes Experts Exchange Unique?
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.
Try it out and discover for yourself.
Subscribe Now
30-day free trial. Register in 60 seconds.
Join the Community
Give a Little. Get a Lot.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Join the Community
by: larksysPosted on 2009-06-10 at 13:46:45ID: 24596216
The following goes in the <head>;
ord,row,co l,store) { OR_CODE && record.data.STRUCTURE_COLO R_CODE != 'undefined') return '<b style="color:#' + record.data.STRUCTURE_COLO R_CODE.rep lace(new RegExp("^[\\s]+", "g"), "") + ';">' + data + '<b>'; ect('grid_ Companies' ); e); // assign custom renderer for Name column in the grid getDataSou rce(),cm); // reconfigure grid >
R_CODE. You can change that to test for your date field. The column name ends up in all caps, so be sure to code it in caps. I believe the column number is relative to zero. You might have to play around with it a bit to find out.
<cfajaximport tags="cfform, cfdiv, cfgrid">
<!--- Special rendering for company name colors --->
<script type="text/javascript" language="javascript">
// custom renderer for Color column
function renderName(data,cellmd,rec
if (record.data.STRUCTURE_COL
else return data;
}
// function to invoke custom renderers and return re-configured grid (called from ajaxonload()
function CompRendGrid() {
mygrid = ColdFusion.Grid.getGridObj
cm = mygrid.getColumnModel();
cm.setRenderer(2,renderNam
mygrid.reconfigure(mygrid.
}
</script>
<!--- fire the custom grid renderers on pageload --->
<cfset ajaxOnLoad("CompRendGrid")
</cfif>
The setRenderer function is passed the grid column number 2 for the company name column. In the function RenderName you will see that I test the grid column record.data.STRUCTURE_COLO
The CompGridRend function defines mygrid using the name of your cfgrid. Mine is grid_Companies.
This is using the default EXT that comes with CF8.