running tables |
Ketan Jetty
enthusiasm for technology
|
||||||||||||||||||
![]() ![]() |
|||||||||||||||||||
running tables Running Tables is a concept in displaying data in an easier to read and understand column wise arrangement instead of the row wise arrangement. This functionality was welcomed by the developers in my company and has become a DeFacto standard within our company and is used by the development and testing teams to verify the database entries. The code is given below, in case, somebody would like to use it.
getDataColumnWise()
<!--- How to use this function. #getDataColumnWise("types",qsTypes)# ---> <cffunction name="getDataColumnWise" returntype="string"> <cfargument name="t" type="string" hint="table name" /> <cfargument name="q" type="query" hint="query object" /> <cfset var retVal = "" /> <cfset var colspanNum = arguments.q.recordCount + 1 /> <cfoutput> <cfsavecontent variable="retVal"> <table cellpadding="2" cellspacing="0"> <tr><td colspan="#colspanNum#" class="tableName">#arguments.t#</td></tr> <cfloop list="#arguments.q.columnList#" index="c"> <tr> <td class="columnName"> #c# </td> <cfloop query="arguments.q"> <cfset tempCol = "#c#[#arguments.q.currentRow#]" /> <cfset tempData = evaluate(tempCol)> <td <cfif IsNumeric(tempData) AND tempData LT 0> class="columnValueRed" <cfelse> class="columnValue"</cfif> > #tempData# </td> </cfloop> </tr> </cfloop> </table> </cfsavecontent> </cfoutput> <cfreturn retVal /> </cffunction>
style sheet for getDataColumnWise()
<style> .tableName { font-size: 11px; font-weight: bolder; font-family: sans-serif; border: 1px solid grey; background: yellow; } .columnName { font-size: 10px; font-family: sans-serif; border: 1px solid grey; border-top: 0px; } .columnValue { font-size: 10px; font-family: sans-serif; color: blue; border: 1px solid grey; border-left: 0px; border-top: 0px; } .columnValueRed { font-size: 10px; font-family: sans-serif; color: red; border: 1px solid grey; border-left: 0px; border-top: 0px; } </style> |
|
||||||||||||||||||
Ketan Jetty @ 2010. All Rights Reserved. |