Rico LiveGrid-Example 2 (editable)
<%
'************************************************************************************************************
' LiveGrid Forms Example, without using session variables
'************************************************************************************************************
' Matt Brown
'************************************************************************************************************
dim oXmlResp
if OpenGridForm(empty,"Orders") then
select case oForm.action
case "table":
' let rest of script be processed
case "query":
DefineFields
set oXmlResp=new ricoXmlResponse
oXmlResp.ProcessQuery oForm.gridID, oForm.SqlSelectData, Empty
set oXmlResp=Nothing
response.end
case else:
DefineFields
oForm.DisplayPage
response.end
end select
end if
%>
<%
Dim RicoClient
set RicoClient = new LoadRicoClient
RicoClient.SetRicoClientParentPath "../../ricoClient/"
RicoClient.CheckQueryString ' just for demo
RicoClient.CreateLinks
set RicoClient = Nothing
%>
Base Library:
The data on this grid can be edited using pop-up forms.
Just click on a grid cell and then select Edit, Delete, or Add from the pop-up menu.
The Add and Edit forms are automatically generated by LiveGrid.
Notice on the Add form how you use the Rico Tree control to select the customer.
Notice on the Edit form how the Rico Calendar is used to change dates.
Updates are disabled on the database, so you will get an error message if you try to save.
"
CloseApp
sub DefineFields()
dim colnum,LookupSQL
'oForm.options("showSaveMsg")="full"
oForm.options("FilterLocation")=-1
'oForm.DebugFlag=true
oForm.options("panelWidth")=500
oForm.options("frozenColumns")=1
oForm.options("menuEvent")="click"
oForm.options("highlightElem")="cursorRow"
oForm.options("XMLprovider")=Request.ServerVariables("SCRIPT_NAME")
oForm.sessions=false
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")="CustomerTree"
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"
end sub
%>