<cftable query = "query_name" maxRows = "maxrows_table" colSpacing = "number_of_spaces" headerLines = "number_of_lines" HTMLTable border colHeaders startRow = "row_number"> </cftable>
Builds a table in a ColdFusion page. Use the cfcol
tag to define table column and row characteristics. The cftable
tag renders data either as preformatted text, or, with the HTMLTable
attribute, as an HTML table. Use cftable
to create tables if you don't want to write HTML table
tag code, or if your data can be well presented as preformatted text. See Usage for information about using the cfcol
tag with the cftable
tag.
cfcol,
cfoutput,
cfcontent,
cfprocessingdirective,
cflog,
cftable
You can use the cfcol tag to align the data in the table, specify the width of each column, and provide column headers.
Note
|
<!--- This example shows the use of cfcol and cftable to align information returned from a query ---> <!--- This query selects employee information from the cfsnippets datasource ---> <cfquery name = "GetEmployees" dataSource = "cfsnippets"> SELECT Emp_ID, FirstName, LastName, EMail, Phone, Department FROM Employees </cfquery> <html> <head> <title>cftable Example</title> </head> <body> <H3>cftable 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>