HTML Table Class
This classes uses array or a SQL query to produce a basic table. I find this class great when making reports or using it with the pagination class.
Code:
dim data(1,1)
data(0,0) = "Value 1.1"
data(0,1) = "Value 1.2"
data(1,0) = "Value 2.1"
data(1,1) = "Value 2.1"
Set createTable = New htmlTable
createTable.caption = "Sample Table"
createTable.headers = array("Title 1","Title 2")
createTable.array_data = data
LocalStr = createTable.build()
Set createTable = Nothing
Response.write LocalStr
Output:
Sample TableTitle 1 | Title 2 |
Value 1.1 |
Value 1.2 |
Value 2.1 |
Value 2.2 |
Definitions for HTML Table ClassPreference | Default | Options | Description |
caption |
optional |
Text |
This is the title for this table. |
headers |
optional |
Array |
This Array builds the headers for the table |
sizes |
optional |
Array |
this Array sets the sizes of the TD's in the table |
table_style |
optional |
Text |
This adds the table style, ie ID="table_style" |
td_style |
optional |
Array |
This array sets additional styles to the TD's in the table |
altRows |
optional |
TRUE or FALSE (boolean) |
Sets if we should set the ALT rows for the styles |
array_data |
Required |
Array |
An Array of data to build the table. |
array_type |
optional |
1 or 2 |
Sets if a single or multidimensional Array |
sql_conn |
Required |
Number |
The Connection Number for the database. A complete list here |
sql_stmt |
Required |
Text |
SQL Statement to be executed. |
build |
Required |
|
This is the statement that builds the table for the output. |