Rico LiveGrid-Example 2 (editable)
<% sqltext="." ' force filtering to "on" in settings box %>
<%
'************************************************************************************************************
' 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 "The actual database updates have been disabled for security reasons and result in an error."
response.write "
"
end sub
sub DefineFields()
oForm.options("RecordName")="Order"
'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.AddEntryField "OrderDate","Order Date","D",Date()
oForm.CurrentField("SelectCtl")="Cal"
oForm.CurrentField("width")=90
oForm.AddEntryField "RequiredDate","Required Date","D",Date()
oForm.CurrentField("SelectCtl")="Cal"
oForm.CurrentField("width")=90
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.AddEntryField "ShipName","Name","B",""
oForm.CurrentField("width")=140
oForm.AddEntryField "ShipAddress","Address","B",""
oForm.CurrentField("width")=140
oForm.AddEntryField "ShipCity","City","B",""
oForm.CurrentField("width")=120
oForm.AddEntryField "ShipRegion","Region","T",""
oForm.CurrentField("width")=60
oForm.AddEntryField "ShipPostalCode","Postal Code","T",""
oForm.CurrentField("width")=100
oForm.AddEntryField "ShipCountry","Country","N",""
oForm.CurrentField("width")=100
'oForm.AutoInit=false
oForm.DisplayPage
end sub
%>