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 = "../../plugins/asp/ricoLiveGridForms.vbs" -->
\r
12 <!-- #INCLUDE FILE = "../../plugins/asp/ricoResponse.vbs" -->
\r
13 <link href="../demo.css" type="text/css" rel="stylesheet" />
\r
15 '************************************************************************************************************
\r
16 ' LiveGrid Forms Example, without using session variables
\r
17 '************************************************************************************************************
\r
19 '************************************************************************************************************
\r
22 if OpenGridForm(empty,"Orders") then
\r
23 select case oForm.action
\r
25 ' let rest of script be processed
\r
28 set oXmlResp=new ricoXmlResponse
\r
29 oXmlResp.ProcessQuery oForm.gridID, oForm.SqlSelectData, Empty
\r
30 set oXmlResp=Nothing
\r
40 <!-- #INCLUDE FILE = "../../plugins/asp/LoadRicoClient.asp" -->
\r
43 set RicoClient = new LoadRicoClient
\r
44 RicoClient.SetRicoClientParentPath "../../ricoClient/"
\r
45 RicoClient.CheckQueryString ' just for demo
\r
46 RicoClient.CreateLinks
\r
47 set RicoClient = Nothing
\r
51 <script type='text/javascript'>
\r
53 // ricoLiveGridForms will call orders_FormInit right before grid & form initialization.
\r
55 function orders_FormInit() {
\r
56 var cal=new Rico.CalendarControl("Cal");
\r
57 Rico.EditControls.register(cal, Rico.imgDir+'calarrow.png');
\r
59 var CustTree=new Rico.TreeControl("CustomerTree","CustTree.asp");
\r
60 Rico.EditControls.register(CustTree, Rico.imgDir+'dotbutton.gif');
\r
63 <style type="text/css">
\r
64 div.ricoLG_outerDiv thead .ricoLG_cell, div.ricoLG_outerDiv thead td, div.ricoLG_outerDiv thead th {
\r
77 <div id='explanation'>
\r
78 Base Library: <script type='text/javascript'>document.write(Rico.Lib+' '+Rico.LibVersion);</script>
\r
79 <hr>The data on this grid can be edited using pop-up forms.
\r
80 Just click on a grid cell and then select Edit, Delete, or Add from the pop-up menu.
\r
81 The Add and Edit forms are automatically generated by LiveGrid.
\r
82 Notice on the Add form how you use the Rico Tree control to select the customer.
\r
83 Notice on the Edit form how the Rico Calendar is used to change dates.
\r
84 Updates are disabled on the database, so you will get an error message if you try to save.
\r
87 <p><strong>Orders Table</strong></p>
\r
92 'response.write "<p><textarea id='orders_debugmsgs' rows='5' cols='80' style='font-size:smaller;'></textarea>"
\r
97 dim colnum,LookupSQL
\r
98 'oForm.options("showSaveMsg")="full"
\r
99 oForm.options("FilterLocation")=-1
\r
100 'oForm.DebugFlag=true
\r
101 oForm.options("panelWidth")=500
\r
102 oForm.options("frozenColumns")=1
\r
103 oForm.options("menuEvent")="click"
\r
104 oForm.options("highlightElem")="cursorRow"
\r
105 oForm.options("XMLprovider")=Request.ServerVariables("SCRIPT_NAME")
\r
106 oForm.sessions=false
\r
108 oForm.AddPanel "Basic Info"
\r
109 oForm.AddEntryFieldW "OrderID","Order ID","B","<auto>",50
\r
110 oForm.ConfirmDeleteColumn
\r
113 LookupSQL="select CustomerID,CompanyName from Customers order by CompanyName"
\r
114 oForm.AddLookupField "CustomerID",empty,"CustID","Customer","CL","",LookupSQL
\r
115 oForm.LookupField("SelectCtl")="CustomerTree"
\r
116 oForm.LookupField("InsertOnly")=true ' do not allow customer to be changed once an order is entered
\r
117 oForm.CurrentField("width")=160
\r
118 oForm.CurrentField("filterUI")="t"
\r
120 LookupSQL="select EmployeeID," & oDB.concat(Array("LastName","', '","FirstName"),false) & " from Employees order by LastName,FirstName"
\r
121 oForm.AddLookupField "EmployeeID",empty,"EmployeeID","Sales Person","SL","",LookupSQL
\r
122 oForm.CurrentField("width")=140
\r
123 oForm.CurrentField("filterUI")="m"
\r
125 oForm.AddEntryFieldW "OrderDate","Order Date","D",Date(),90
\r
126 oForm.CurrentField("SelectCtl")="Cal"
\r
127 oForm.AddEntryFieldW "RequiredDate","Required Date","D",Date(),90
\r
128 oForm.CurrentField("SelectCtl")="Cal"
\r
129 oForm.AddCalculatedField "select sum(UnitPrice*Quantity*(1.0-Discount)) from order_details d where d.OrderID=t.OrderID","Net Sale"
\r
130 oForm.CurrentField("format")="DOLLAR"
\r
131 oForm.CurrentField("width")=80
\r
133 oForm.AddPanel "Ship To"
\r
134 oForm.AddEntryFieldW "ShipName","Name","B","",140
\r
135 oForm.AddEntryFieldW "ShipAddress","Address","B","",140
\r
136 oForm.AddEntryFieldW "ShipCity","City","B","",120
\r
137 oForm.CurrentField("filterUI")="s"
\r
138 oForm.AddEntryFieldW "ShipRegion","Region","T","",60
\r
139 oForm.AddEntryFieldW "ShipPostalCode","Postal Code","T","",100
\r
141 ' display ShipCountry with a link to wikipedia
\r
142 colnum=oForm.AddEntryFieldW("ShipCountry","Country","N","",100)
\r
143 oForm.CurrentField("control")="new Rico.TableColumn.link('http://en.wikipedia.org/wiki/{" & colnum & "}','_blank')"
\r
144 oForm.CurrentField("filterUI")="s"
\r