Rico LiveGrid-Example 2 (editable)
<%
'************************************************************************************************************
' LiveGrid Plus-Edit Example
'************************************************************************************************************
' Matt Brown
'************************************************************************************************************
if OpenGridForm(empty,"Orders") then
if oForm.action="table" then
DisplayTable
else
DefineFields
end if
end if
CloseApp
sub DisplayTable()
response.write "
"
GridSettingsForm
response.write "
This example demonstrates how database records can be updated via AJAX. "
response.write "Try selecting add, edit, or delete from the pop-up menu. "
response.write "If you select add, then click the '...' button next to customer, you will see the Rico tree control."
response.write "As shipped with the Rico distribution, the ASP LiveGrid examples use a MS Access database. "
response.write "This database cannot be updated from the web; therefore, form save operations will fail "
response.write "unless you change to another database."
response.write "
"
end sub
sub DefineFields()
dim colnum
'oForm.options("showSaveMsg")="full"
oForm.AddPanel "Basic Info"
oForm.AddEntryField "OrderID","Order ID","B",""
oForm.ConfirmDeleteColumn
oForm.CurrentField("width")=50
oForm.SortAsc
oForm.AddEntryField "CustomerID","Customer","CL",""
oForm.CurrentField("SelectCtl")="CustomerTree"
oForm.CurrentField("SelectSql")="select CustomerID,CompanyName from Customers order by CompanyName"
oForm.CurrentField("InsertOnly")=true ' do not allow customer to be changed once an order is entered
oForm.CurrentField("width")=160
oForm.AddEntryField "EmployeeID","Sales Person","SL",""
oForm.CurrentField("SelectSql")="select EmployeeID," & oDB.concat(Array("LastName","', '","FirstName"),false) & " from Employees order by LastName,FirstName"
oForm.CurrentField("width")=140
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.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.AutoInit=false
oForm.DisplayPage
end sub
%>