Xbasic

a5_generate_html_table Function

Syntax

P a5_Generate_HTML_Table(P rs, C style [,N maxRows [,L flagShowHTML ]])

Arguments

rsSQL::ResultSetTABLE Pointer

A SQL::Result set or pointer to an open DBF TABLE object.

styleCharacter

The style name is used to generate the class names assigned to the table elements in the generated HTML. E.g. "Alpha" or "GrBlue".

If you specify a "modern" style (e.g. "Alpha" or "GrBlue"), the classes assigned to the parts of the generated table will be those which map to the abstract class map names listed below (see Resolve abstract CSS class names to learn more about abstract class names):

[class.gridPart]

Added to the <table> element.

[class.gridHeader]

Added to <th> elements.

[class.gridData]

Added to <td> elements containing data. Used in all odd data rows.

[class.gridDataAltOn]

Added to <td> elements containing data. Used in all even data rows.

[class.gridSeparator]

Added to the <td> element in separator rows

If a "legacy" style is used (e.g. "MobBlue"), the class names in the generated HTML will be similar to the ones listed below. (This is also the behavior in version 4.5.4.5 and older of Alpha Anywhere.):

<style>FormTABLE

Added to the <table> element.

<style>ColumnTD

Added to <th> elements.

<style>DataTD

Added to <td> elements containing data. Used in all odd data rows.

<style>AltDataTD

Added to <td> elements containing data. Used in all even data rows.

<style>SeparatorTD

Added to the <td> element in separator rows

maxRowsNumeric

Default = 0 (all rows). The number of rows to to include in the table.

flagShowHTMLLogical

Default = .f.. Desktop Applications Only If .t., the generated HTML will be shown in a popup window. This property should be set to .f. in all web applications.

Returns

htmlPointer

Returns a dot variable with the following properties:

completePageCharacter

A full HTML page that includes the generated table.

htmlTableCharacter

The HTML for the table.

Description

Takes a pointer to an open DBF table or SQL::ResultSet and generates an HTML table for all of the columns in the row.

Example

stylename = "MobBlue"
dim cn as sql::Connection
cn.open("::Name::AADemo-Northwind")
cn.execute("SELECT CustomerId, Address, City, Country FROM CUSTOMERS")
dim html as p = a5_Generate_HTML_table(cn.ResultSet,stylename,14)

dim html2 as c 
' Process html table with style information
html2 = a5_html_page_prepare(html.htmltable,"",.f.,stylename)

' Show the page
a5_show_htmlchrome(html2)

stylename = "Alpha"
cn.execute("SELECT CustomerId, Address, City, Country FROM CUSTOMERS")
html = a5_Generate_HTML_table(cn.ResultSet,stylename,4)

' Process html table with style information
html2 = a5_html_page_prepare(html.htmltable,"",.f.,stylename)

' Show the page
a5_show_htmlchrome(html2)