| CFML Reference
|
|
ColdFusion Tags
|
cfcol
Description
Defines table column header, width, alignment, and text. Used only inside a cftable.
Category
Data output tags
Syntax
<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">
See also
cfcontent, cfoutput, cftable
Attributes
| Attribute |
Description |
header
|
Required. The text for the column's header.
|
width
|
Optional. The width of the column in characters (the default is 20). If the length of the data displayed exceeds the width value, the data is truncated to fit.
|
align
|
Optional. Column alignment, Left, Right, or Center.
|
text
|
Optional. Double-quote delimited text that determines what displays in the column. The rules for the text attribute are identical to the rules for cfoutput sections; it can consist of a combination of literal text, HTML tags, and query record set field references. You can embed hyperlinks, image references, and input controls in columns.
|
Example <!--- 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>
|
Copyright © 2001, Macromedia Inc. All rights reserved. |
|
|