3.25.2009

cfGrid, CSS and Custom Date Rendering...

CSS for center align a column: .x-grid-col-2 { text-align:center;
}

Columns are numbered left to right.  Cells seem to all use the same class.

Sql Server was returning Date Times and I only wanted Dates and I found this code for a customer date renderer very helpful.
http://www.coldfusionguy.com/ColdFusion/blog/index.cfm/2007/11/27/CFGrid-Custom-Date-Renderer

setDateRenderer = function(){
mygrid = ColdFusion.Grid.getGridObject('GridName');
cm = mygrid.getColumnModel();
cm.setRenderer(1, Ext.util.Format.dateRenderer('l, F d, Y'));
cm.setRenderer(2, Ext.util.Format.dateRenderer('l, F d, Y'));
mygrid.reconfigure(mygrid.getDataSource(),cm);
}

I think I found the date formats in the EXT documentation.

No comments: