wwHtmlHelpers.HtmlRecord

Displays a single record or object as an HTML form from a cursor or object as a string:

You can also generate an input form using HtmlRecordConfig.DisplayMode.

This implementation creates a Bootstrap grid layout that uses a CSS styling to control rendering and formatting for the table and columns. Automatic mode renders a HTML from existing data using meta data, or you can manually configure columns to add to the display.

HtmlRecord(lvData, loConfig)

Parameters

lvData
Name of the Cursor/Alias to render, or an instance of an object to render.

loConfig
Optional - an HtmlRecordConfig instance that provides configuration for the HtmlRecord function

Remarks

If you bind to an object and pass the object reference make sure this object is marked as PRIVATE so that HtmlRecord can see it when binding.

Example

The following creates a generic unconfigured HTML table from the selected record:

* **Find a specific record in a table
SELECT Customers
LOCATE FOR Pk = 2

* **now create the HTML (return value outputs)
lcHtml =  HtmlRecord("Customers")

The next example allows more configuration for the display and individual columns used:

***Find a specific record in a table
SELECT Customers
LOCATE FOR Pk = 2

***Create a configuration objec
loConfig = CREATEOBJECT("HtmlRecordConfig")
loConfig.Width = "700px"
loConfig.HeaderCssClass = "myrecordheader"
loConfig.ItemCssClass = "myitems"

***Create columns manually for each field
loCol = CREATEOBJECT("HtmlRecordColumn","Company")
loConfig.AddColumn(loCol)

loCol = CREATEOBJECT("HtmlRecordColumn","CareOf","Name")
loConfig.AddColumn(loCol)

loCol = CREATEOBJECT("HtmlRecordColumn","BillRate","Billing Rate")
loConfig.FieldType="N"
loConfig.Format="$$,$$$.99"
loConfig.AddColumn(loCol)

loCol = CREATEOBJECT("HtmlRecordColumn",[ShortDate(Entered,2)],"Entered")
loCol.FieldType = "C"
loConfig.AddColumn(loCol)

***now create the HTML (return value outputs)
lcHtml = HtmlRecord("Customers",loConfig)

See also:

Class wwHtmlHelpers

© West Wind Technologies, 1996-2024 • Updated: 11/04/18
Comment or report problem with topic