Rico LiveGrid-Example 2 (editable)
<%
Dim RicoClient
set RicoClient = new LoadRicoClient
RicoClient.SetRicoClientParentPath "../../ricoClient/"
RicoClient.CheckQueryString ' just for demo
RicoClient.CreateLinks
set RicoClient = Nothing
%>
<%
'************************************************************************************************************
' LiveGrid Plus-Edit Example
'************************************************************************************************************
' Matt Brown
'************************************************************************************************************
if OpenGridForm(empty,"Orders") then
if oForm.action="table" then DisplayHeading
DefineFields
end if
CloseApp
sub DisplayHeading()
response.write vbLf & "
"
response.write vbLf & "Base Library: "
response.write vbLf & "The data on this grid can be edited using pop-up forms. "
response.write vbLf & "Just click on a grid cell and then select Edit, Delete, or Add from the pop-up menu. "
response.write vbLf & "The Add and Edit forms are automatically generated by LiveGrid. "
response.write vbLf & "Notice on the Add form how you use the Rico Tree control to select the customer. "
response.write vbLf & "Notice on the Edit form how the Rico Calendar is used to change dates. "
response.write vbLf & "Updates are disabled on the database, so you will get an error message if you try to save."
response.write vbLf & "
"
response.write vbLf & "
Orders Table
"
end sub
sub DefineFields()
dim colnum,LookupSQL
'oForm.options("showSaveMsg")="full"
'oForm.DebugFlag=true
oForm.options("FilterLocation")=-1
oForm.options("panelWidth")=500
oForm.options("frozenColumns")=1
oForm.options("menuEvent")="click"
oForm.options("highlightElem")="cursorRow"
oForm.AddPanel "Basic Info"
oForm.AddEntryFieldW "OrderID","Order ID","B","",50
oForm.ConfirmDeleteColumn
oForm.SortAsc
LookupSQL="select CustomerID,CompanyName from Customers order by CompanyName"
oForm.AddLookupField "CustomerID",empty,"CustID","Customer","CL","",LookupSQL
oForm.LookupField("SelectCtl")="CustomerSearch"
oForm.LookupField("InsertOnly")=true ' do not allow customer to be changed once an order is entered
oForm.CurrentField("width")=160
oForm.CurrentField("filterUI")="t"
LookupSQL="select EmployeeID," & oDB.concat(Array("LastName","', '","FirstName"),false) & " from Employees order by LastName,FirstName"
oForm.AddLookupField "EmployeeID",empty,"EmployeeID","Sales Person","SL","",LookupSQL
oForm.CurrentField("width")=140
oForm.CurrentField("filterUI")="m"
oForm.AddEntryFieldW "OrderDate","Order Date","D",Date(),90
oForm.CurrentField("SelectCtl")="Cal"
oForm.AddEntryFieldW "RequiredDate","Required Date","D",Date(),90
oForm.CurrentField("SelectCtl")="Cal"
oForm.AddCalculatedField "select sum(UnitPrice*Quantity*(1.0-Discount)) from order_details d where d.OrderID=t.OrderID","Net Sale"
oForm.CurrentField("format")="DOLLAR"
oForm.CurrentField("width")=80
oForm.AddPanel "Ship To"
oForm.AddEntryFieldW "ShipName","Name","B","",140
oForm.AddEntryFieldW "ShipAddress","Address","B","",140
oForm.AddEntryFieldW "ShipCity","City","B","",120
oForm.CurrentField("filterUI")="s"
oForm.AddEntryFieldW "ShipRegion","Region","T","",60
oForm.AddEntryFieldW "ShipPostalCode","Postal Code","T","",100
' display ShipCountry with a link to wikipedia
colnum=oForm.AddEntryFieldW("ShipCountry","Country","N","",100)
oForm.CurrentField("control")="new Rico.TableColumn.link('http://en.wikipedia.org/wiki/{" & colnum & "}','_blank')"
oForm.CurrentField("filterUI")="s"
'oForm.AutoInit=false
oForm.DisplayPage
end sub
%>