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','Tree');
\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 CustTree=new Rico.TreeControl("CustomerTree","CustTree.asp");
\r
25 Rico.EditControls.register(CustTree, 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 & "<table id='explanation' border='0' cellpadding='0' cellspacing='5' style='clear:both'><tr valign='top'><td>"
\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 & "</td><td>"
\r
65 response.write vbLf & "<script type='text/javascript'><!--"
\r
66 response.write vbLf & "google_ad_client = 'pub-7218597156507462';"
\r
67 response.write vbLf & "/* 125x125, created 5/11/09 */"
\r
68 response.write vbLf & "google_ad_slot = '9298106441';"
\r
69 response.write vbLf & "google_ad_width = 125;"
\r
70 response.write vbLf & "google_ad_height = 125;"
\r
71 response.write vbLf & "//-->"
\r
72 response.write vbLf & "</script>"
\r
73 response.write vbLf & "<script type='text/javascript' src='http://pagead2.googlesyndication.com/pagead/show_ads.js'></script>"
\r
74 response.write vbLf & "</td></tr></table>"
\r
75 response.write vbLf & "<p><strong>Orders Table</strong></p>"
\r
80 dim colnum,LookupSQL
\r
81 'oForm.options("showSaveMsg")="full"
\r
82 'oForm.DebugFlag=true
\r
83 oForm.options("FilterLocation")=-1
\r
84 oForm.options("panelWidth")=500
\r
85 oForm.options("frozenColumns")=1
\r
86 oForm.options("menuEvent")="click"
\r
87 oForm.options("highlightElem")="cursorRow"
\r
89 oForm.AddPanel "Basic Info"
\r
90 oForm.AddEntryFieldW "OrderID","Order ID","B","<auto>",50
\r
91 oForm.ConfirmDeleteColumn
\r
94 LookupSQL="select CustomerID,CompanyName from Customers order by CompanyName"
\r
95 oForm.AddLookupField "CustomerID",empty,"CustID","Customer","CL","",LookupSQL
\r
96 oForm.LookupField("SelectCtl")="CustomerTree"
\r
97 oForm.LookupField("InsertOnly")=true ' do not allow customer to be changed once an order is entered
\r
98 oForm.CurrentField("width")=160
\r
99 oForm.CurrentField("filterUI")="t"
\r
101 LookupSQL="select EmployeeID," & oDB.concat(Array("LastName","', '","FirstName"),false) & " from Employees order by LastName,FirstName"
\r
102 oForm.AddLookupField "EmployeeID",empty,"EmployeeID","Sales Person","SL","",LookupSQL
\r
103 oForm.CurrentField("width")=140
\r
104 oForm.CurrentField("filterUI")="m"
\r
106 oForm.AddEntryFieldW "OrderDate","Order Date","D",Date(),90
\r
107 oForm.CurrentField("SelectCtl")="Cal"
\r
108 oForm.AddEntryFieldW "RequiredDate","Required Date","D",Date(),90
\r
109 oForm.CurrentField("SelectCtl")="Cal"
\r
110 oForm.AddCalculatedField "select sum(UnitPrice*Quantity*(1.0-Discount)) from order_details d where d.OrderID=t.OrderID","Net Sale"
\r
111 oForm.CurrentField("format")="DOLLAR"
\r
112 oForm.CurrentField("width")=80
\r
114 oForm.AddPanel "Ship To"
\r
115 oForm.AddEntryFieldW "ShipName","Name","B","",140
\r
116 oForm.AddEntryFieldW "ShipAddress","Address","B","",140
\r
117 oForm.AddEntryFieldW "ShipCity","City","B","",120
\r
118 oForm.CurrentField("filterUI")="m"
\r
119 oForm.AddEntryFieldW "ShipRegion","Region","T","",60
\r
120 oForm.AddEntryFieldW "ShipPostalCode","Postal Code","T","",100
\r
122 ' display ShipCountry with a link to wikipedia
\r
123 colnum=oForm.AddEntryFieldW("ShipCountry","Country","N","",100)
\r
124 oForm.CurrentField("control")="new Rico.TableColumn.link('http://en.wikipedia.org/wiki/{" & colnum & "}','_blank')"
\r
125 oForm.CurrentField("filterUI")="s"
\r
127 'oForm.AutoInit=false
\r