FUNCTION GuestBrowser
************************************************************************
* wwDemoProcess :: BrowseGuests
*******************************
*** Function: Shows a list of Guests in table form for the Guest
*** Sample application.
*** This example manually creates the Browse page.
************************************************************************
LOCAL lcOrder, loConfig
*** Retrieve the Order Radio Button Value - Name, Company, Location
lcOrderVal=TRIM(Request.Form("radOrder"))
IF EMPTY(lcOrderVal)
lcOrderVal="Company"
ENDIF
*** Build an Order By expression
lcOrder="UPPER("+lcOrderVal+")"
*** Run a query for the list of data to display
SELECT custid, Name, company, location, entered, &lcOrder ;
FROM Guest ;
ORDER BY 6 ;
INTO CURSOR TQuery
*** Create a configuration helper object for our data grid
*** to set rendering options and each individual column to render
LOCAL loConfig as HtmlDataGridConfig
loConfig = CREATEOBJECT("HtmlDataGridConfig")
*** Main configuration options
loConfig.id = "tblGuests"
loConfig.Style = "margin-top: 15px;"
loConfig.DataKeyField = "custId"
*** Paging configuration
loConfig.PageSize = 7
*** Embedding a plain and simple field
loConfig.AddColumn([HtmlLink("Guest_Book.wwd?id=" + TRIM(custId),Name)],"Name")
*** Embedding a link with an expression - an HREF link in this case
loConfig.AddColumn("Company","Company")
*** Embedding a plain and simple field
loConfig.AddColumn("Location","Location")
loColumn = CREATEOBJECT("HtmlDataGridColumn")
loColumn.Expression = "ShortDate(Entered,1)"
loColumn.HeaderText = "Entered"
loColumn.ItemAttributeString = [style="background-color: steelblue; color: white;"]
loColumn.Sortable = .T.
loConfig.AddColumn(loColumn)
*** Store config in PRIVATE variable visible in the Template
PRIVATE poDataGridConfig
poDataGridConfig = loConfig
*** Render values into HTML Template
Response.ExpandTemplate(this.cHtmlPagePath + "wcscripts\guestbrowser.wc")
IF USED("Guest")
USE IN Guest
ENDIF
ENDFUNC