Defines table column header, width, alignment, and text. Used only inside a cftable
.
<cfcol header = "column_header_text" width = "number_indicating_width_of_column" align = "Left" or "Right" or "Center" text = "double_quote_delimited_text_indicating_type_of_text">
<!--- This example shows the use of cfcol and cftable to align information returned from a query ---> <!--- this query selects employee information from the cfsnippets data source ---> <cfquery name = "GetEmployees" dataSource = "cfsnippets"> SELECT Emp_ID, FirstName, LastName, EMail, Phone, Department FROM Employees </cfquery> <html> <head> <title> cfcol Example </title> </head> <body> <H3>cfcol Example</H3> <!--- Note the use of the HTMLTable attribute to display the cftable as an HTML table, rather simply as PRE formatted information ---> <cftable query = "GetEmployees" startRow = "1" colSpacing = "3" HTMLTable> <!--- each cfcol tag sets the width of a column in the table, as well as specifying the header information and the text/CFML with which to fill the cell ---> <cfcol header = "<B>ID</B>" align = "Left" width = 2 text = "#Emp_ID#"> <cfcol header = "<B>Name/Email</B>" align = "Left" width = 15 text = "<a href = 'mailto:#Email#'>#FirstName# #LastName#</A>"> <cfcol header = "<B>Phone Number</B>" align = "Center" width = 15 text = "#Phone#"> </cftable> </body> </html>