1 <%@ LANGUAGE="VBSCRIPT" %>
\r
2 <% Response.CacheControl = "no-cache" %>
\r
3 <% Response.AddHeader "Pragma", "no-cache" %>
\r
4 <% Response.Expires = -1 %>
\r
5 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
\r
8 <title>Rico LiveGrid-Example 2 (editable)</title>
\r
10 <!-- #INCLUDE FILE = "dbConnect.asp" -->
\r
11 <!-- #INCLUDE FILE = "LoadRicoClient.asp" -->
\r
12 <!-- #INCLUDE FILE = "../../plugins/asp/ricoLiveGridForms.vbs" -->
\r
13 <link href="../demo.css" type="text/css" rel="stylesheet" />
\r
15 <script type='text/javascript'>
\r
16 Rico.loadModule('LiveGridForms','Calendar','SearchBox');
\r
18 // ricoLiveGridForms will call orders_FormInit right before grid & form initialization.
\r
20 function orders_FormInit() {
\r
21 var cal=new Rico.CalendarControl("Cal");
\r
22 Rico.EditControls.register(cal, Rico.imgDir+'calarrow.png');
\r
24 var kwSearch=new Rico.KeywordSearch("CustomerSearch");
\r
25 Rico.EditControls.register(kwSearch, Rico.imgDir+'dotbutton.gif');
\r
28 <style type="text/css">
\r
29 div.ricoLG_outerDiv thead .ricoLG_cell, div.ricoLG_outerDiv thead td, div.ricoLG_outerDiv thead th {
\r
42 '************************************************************************************************************
\r
43 ' LiveGrid Plus-Edit Example
\r
44 '************************************************************************************************************
\r
46 '************************************************************************************************************
\r
48 if OpenGridForm(empty,"Orders") then
\r
49 if oForm.action="table" then DisplayHeading
\r
55 sub DisplayHeading()
\r
56 response.write vbLf & "<div id='explanation'>"
\r
57 response.write vbLf & "Base Library: <script type='text/javascript'>document.write(Rico.Lib+' '+Rico.LibVersion);</script>"
\r
58 response.write vbLf & "<hr>The data on this grid can be edited using pop-up forms. "
\r
59 response.write vbLf & "Just click on a grid cell and then select Edit, Delete, or Add from the pop-up menu. "
\r
60 response.write vbLf & "The Add and Edit forms are automatically generated by LiveGrid. "
\r
61 response.write vbLf & "Notice on the Add form how you use the Rico Tree control to select the customer. "
\r
62 response.write vbLf & "Notice on the Edit form how the Rico Calendar is used to change dates. "
\r
63 response.write vbLf & "Updates are disabled on the database, so you will get an error message if you try to save."
\r
64 response.write vbLf & "</div>"
\r
65 response.write vbLf & "<p><strong>Orders Table</strong></p>"
\r
70 dim colnum,LookupSQL
\r
71 'oForm.options("showSaveMsg")="full"
\r
72 'oForm.DebugFlag=true
\r
73 oForm.options("FilterLocation")=-1
\r
74 oForm.options("panelWidth")=500
\r
75 oForm.options("frozenColumns")=1
\r
76 oForm.options("menuEvent")="click"
\r
77 oForm.options("highlightElem")="cursorRow"
\r
79 oForm.AddPanel "Basic Info"
\r
80 oForm.AddEntryFieldW "OrderID","Order ID","B","<auto>",50
\r
81 oForm.ConfirmDeleteColumn
\r
84 LookupSQL="select CustomerID,CompanyName from Customers order by CompanyName"
\r
85 oForm.AddLookupField "CustomerID",empty,"CustID","Customer","CL","",LookupSQL
\r
86 oForm.LookupField("SelectCtl")="CustomerSearch"
\r
87 oForm.LookupField("InsertOnly")=true ' do not allow customer to be changed once an order is entered
\r
88 oForm.CurrentField("width")=160
\r
89 oForm.CurrentField("filterUI")="t"
\r
91 LookupSQL="select EmployeeID," & oDB.concat(Array("LastName","', '","FirstName"),false) & " from Employees order by LastName,FirstName"
\r
92 oForm.AddLookupField "EmployeeID",empty,"EmployeeID","Sales Person","SL","",LookupSQL
\r
93 oForm.CurrentField("width")=140
\r
94 oForm.CurrentField("filterUI")="m"
\r
96 oForm.AddEntryFieldW "OrderDate","Order Date","D",Date(),90
\r
97 oForm.CurrentField("SelectCtl")="Cal"
\r
98 oForm.AddEntryFieldW "RequiredDate","Required Date","D",Date(),90
\r
99 oForm.CurrentField("SelectCtl")="Cal"
\r
100 oForm.AddCalculatedField "select sum(UnitPrice*Quantity*(1.0-Discount)) from order_details d where d.OrderID=t.OrderID","Net Sale"
\r
101 oForm.CurrentField("format")="DOLLAR"
\r
102 oForm.CurrentField("width")=80
\r
104 oForm.AddPanel "Ship To"
\r
105 oForm.AddEntryFieldW "ShipName","Name","B","",140
\r
106 oForm.AddEntryFieldW "ShipAddress","Address","B","",140
\r
107 oForm.AddEntryFieldW "ShipCity","City","B","",120
\r
108 oForm.CurrentField("filterUI")="s"
\r
109 oForm.AddEntryFieldW "ShipRegion","Region","T","",60
\r
110 oForm.AddEntryFieldW "ShipPostalCode","Postal Code","T","",100
\r
112 ' display ShipCountry with a link to wikipedia
\r
113 colnum=oForm.AddEntryFieldW("ShipCountry","Country","N","",100)
\r
114 oForm.CurrentField("control")="new Rico.TableColumn.link('http://en.wikipedia.org/wiki/{" & colnum & "}','_blank')"
\r
115 oForm.CurrentField("filterUI")="s"
\r
117 'oForm.AutoInit=false
\r