Fix wheel scrolling on LiveGrid content
[infodrom/rico3] / examples / dotnet / 3grids.aspx
1 <%@ Page Language="VB" ResponseEncoding="iso-8859-1" %>\r
2 <%@ Register TagPrefix="Rico" Assembly="Rico" NameSpace="Rico" %>\r
3 <%@ Register TagPrefix="My" TagName="dbLib" Src="dbConnect.ascx" %>\r
4 <My:dbLib id='app' runat='server' />\r
5 \r
6 <script runat="server">\r
7 \r
8 Sub Page_Load(Sender As object, e As EventArgs)\r
9   Session.Timeout=60\r
10   if app.OpenGrid(customer, Rico.menuEvents.contextmenu) then\r
11     app.SetGridOptions(order, Rico.menuEvents.contextmenu)\r
12     app.SetGridOptions(detail, Rico.menuEvents.contextmenu)\r
13     order.sendDebugMsgs=true\r
14     order.LogSqlOnError=true\r
15     detail.sendDebugMsgs=true\r
16     detail.LogSqlOnError=true\r
17   end if\r
18 End Sub\r
19 \r
20 </script>\r
21 \r
22 \r
23 \r
24 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">\r
25 <html>\r
26 <head>\r
27 <title>Rico LiveGrid-3 Grid Example</title>\r
28 \r
29 <Rico:LoadClient checkQueryString='true' runat='server' />\r
30 <link href="../demo.css" type="text/css" rel="stylesheet" />\r
31 \r
32 <script type="text/javascript">\r
33 \r
34 function MeasureLayout() {\r
35   var c=Rico.select('div.gridcontainer');\r
36   var msg='';\r
37   for (var i=0; i < c.length; i++)\r
38     msg+='Container'+i+': offsetHeight='+c[i].offsetHeight+'  scrollHeight='+c[i].scrollHeight+'\n';\r
39   alert(msg);\r
40 }\r
41 \r
42 function customerDrillDown(e) {
43   var cell=Rico.eventElement(e);
44   cell=Rico.getParentByTagName(cell,'div','ricoLG_cell');\r
45   if (!cell) return;\r
46   Rico.eventStop(e);
47   var winIdx=customer['grid'].winCellIndex(cell);\r
48   var dataIdx=customer['grid'].datasetIndex(cell);\r
49   if (!dataIdx.onBlankRow) {\r
50     customer['grid'].highlight(winIdx);\r
51     var custid=customer['grid'].columns[0].getValue(winIdx.row);\r
52     Rico.$("order_caption").innerHTML='Orders for '+custid;\r
53     Rico.$("detail_caption").innerHTML="";\r
54     order['grid'].columns[0].setSystemFilter("EQ",custid);\r
55     detail['grid'].resetContents();\r
56   }\r
57   return false;
58 }\r
59 \r
60 function orderDrillDown(e) {
61   var cell=Rico.eventElement(e);
62   cell=Rico.getParentByTagName(cell,'div','ricoLG_cell');\r
63   if (!cell) return;\r
64   Rico.eventStop(e);
65   var winIdx=order['grid'].winCellIndex(cell);\r
66   var dataIdx=order['grid'].datasetIndex(cell);\r
67   if (!dataIdx.onBlankRow) {\r
68     order['grid'].highlight(winIdx);\r
69     var orderid=order['grid'].columns[1].getValue(winIdx.row);\r
70     Rico.$("detail_caption").innerHTML='Order #'+orderid;\r
71     detail['grid'].columns[0].setSystemFilter("EQ",orderid);\r
72   }\r
73   return false;
74 }\r
75 \r
76 function detailDataMenu(objCell,onBlankRow) {\r
77   return !onBlankRow;\r
78 }\r
79 \r
80 </script>\r
81 \r
82 <style type="text/css">\r
83  html, body {\r
84     height:96%;\r
85     margin: 0px;\r
86     padding: 0px;\r
87     border: none;\r
88  }\r
89 \r
90 \r
91 .gridcontainer {\r
92   margin-left:5px;\r
93   width:70%;\r
94   overflow:visible;\r
95   float: left;\r
96   font-size: 8pt !important;\r
97 }\r
98 \r
99 #explanation {\r
100   overflow:auto;\r
101   height:99%;\r
102   width:25%;\r
103   font-size:8pt;\r
104   font-family:Verdana, Arial, Helvetica, sans-serif;\r
105   float: left;\r
106   padding: 5px;\r
107 }\r
108 </style>\r
109 \r
110 </head>\r
111 \r
112 \r
113 \r
114 <body>\r
115 \r
116 <div id='explanation'>\r
117 Base Library: \r
118 <script type='text/javascript'>\r
119 document.write(Rico.Lib+' '+Rico.LibVersion);\r
120 </script>\r
121 <hr>\r
122 <p>Unlike the other examples, grid menus are activated in this example\r
123 by <strong>right-clicking</strong> on a grid (ctrl-click in Opera, Konqueror, or Safari). \r
124 <p>To filter: right-click \r
125 on the value that you would like to use as the basis for filtering, \r
126 then select the desired filtering method from the pop-up menu.\r
127 <p>Right-click anywhere in a column to see sort, hide, and show options.\r
128 <p><strong>Double-click</strong> on a row to see all orders for that customer.\r
129 Double-click on an order to see the line items for that order.\r
130 <p>Drag the edge of a column heading to resize a column.\r
131 <!--\r
132 <p><button onclick='MeasureLayout();'>Measure Grid Containers</button>\r
133 -->\r
134 </div>\r
135 \r
136 <div class='gridcontainer' style='height:39%'>\r
137 \r
138 <Rico:LiveGrid runat='server' id='customer' caption='Customers' rows='-4' frozenColumns='2' DefaultSort='CustomerID' menuEvent='contextmenu' DisplayTimer='false' highlightElem='menuRow' dblclick="Rico.eventHandle(window,'customerDrillDown')">\r
139   <Rico:Style runat='server' StyleId="Default" fontsize="8" />\r
140   <Rico:Table runat='server' TblName='customers' />\r
141   <Rico:TableCol runat='server' heading='Cust ID'     colname='CustomerID'  width='60' />\r
142   <Rico:TableCol runat='server' heading='Company'     colname='CompanyName' width='150' />\r
143   <Rico:TableCol runat='server' heading='Contact'     colname='ContactName' width='115' />\r
144   <Rico:TableCol runat='server' heading='Address'     colname='Address'     width='130' />\r
145   <Rico:TableCol runat='server' heading='City'        colname='City'        width='90' />\r
146   <Rico:TableCol runat='server' heading='Region'      colname='Region'      width='60' />\r
147   <Rico:TableCol runat='server' heading='Postal Code' colname='PostalCode'  width='90' />\r
148   <Rico:TableCol runat='server' heading='Country'     colname='Country'     width='100' />\r
149   <Rico:TableCol runat='server' heading='Phone'       colname='Phone'       width='115' />\r
150   <Rico:TableCol runat='server' heading='Fax'         colname='Fax'         width='115' />\r
151 </Rico:LiveGrid>\r
152 \r
153 </div>\r
154 <div class='gridcontainer' style='height:30%'>\r
155 \r
156 <Rico:LiveGrid runat='server' id='order' caption='' rows='-4' prefetchBuffer='false' DefaultSort='OrderID' menuEvent='contextmenu' DisplayTimer='false' highlightElem='menuRow' dblclick="Rico.eventHandle(window,'orderDrillDown')">\r
157   <Rico:Style runat='server' StyleId="Default" fontsize="8" />\r
158   <Rico:Table runat='server' TblName='orders' />\r
159   <Rico:TableCol runat='server' heading='Cust ID'    colname='CustomerID'  width='60' canSort='false' visible='false' />\r
160   <Rico:TableCol runat='server' heading='Order#'       colname='OrderID'     width='60' />\r
161   <Rico:TableCol runat='server' heading='Ship Name'    colname='ShipName'    width='150' />\r
162   <Rico:TableCol runat='server' heading='Ship City'    colname='ShipCity'    width='80' />\r
163   <Rico:TableCol runat='server' heading='Ship Country' colname='ShipCountry' width='90' />\r
164   <Rico:TableCol runat='server' heading='Order Date'   colname='OrderDate'   width='100' datatype='date' />\r
165   <Rico:TableCol runat='server' heading='Ship Date'    colname='ShippedDate' width='100' datatype='date' />\r
166 </Rico:LiveGrid>\r
167 \r
168 </div>\r
169 <div class='gridcontainer' style='height:30%'>\r
170 \r
171 <Rico:LiveGrid runat='server' id='detail' caption='' rows='-4' prefetchBuffer='false' menuEvent='contextmenu' DisplayTimer='false' highlightElem='menuRow'>\r
172   <Rico:Style runat='server' StyleId="Default" fontsize="8" />\r
173   <Rico:Table runat='server' TblName='order_details' TblAlias='t' />\r
174   <Rico:Table runat='server' TblName='products' TblAlias='p' JoinCondition='t.ProductId=p.ProductId' />\r
175   <Rico:TableCol runat='server' heading='Order#'        colname='OrderID' width='60' canSort='false' visible='false' />\r
176   <Rico:TableCol runat='server' heading='Description'   colname='ProductName' width='150' TblAlias='p' />\r
177   <Rico:TableCol runat='server' heading='Unit Quantity' colname='QuantityPerUnit' width='125' TblAlias='p' />\r
178   <Rico:TableCol runat='server' heading='Unit Price'    colname='UnitPrice' width='80' datatype='Dollar' TblAlias='p' />\r
179   <Rico:TableCol runat='server' heading='Qty'           colname='Quantity' width='50' datatype='number' />\r
180   <Rico:FormulaCol runat='server' heading='Total'       formula='t.UnitPrice*t.Quantity' width='80' datatype='Dollar' />\r
181   <Rico:TableCol runat='server' heading='Discount'      colname='Discount' width='80' datatype='Percent' />\r
182   <Rico:FormulaCol runat='server' heading='Net Price'   formula='t.UnitPrice*t.Quantity*(1.0-Discount)' width='90' datatype='Dollar' />\r
183 </Rico:LiveGrid>\r
184 \r
185 </div>\r
186 \r
187 </body>\r
188 </html>\r