2 if (!isset ($_SESSION)) session_start();
\r
4 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
\r
7 <title>Rico LiveGrid-Example 2</title>
\r
10 require "dbConnect.php";
\r
11 require "LoadRicoClient.php";
\r
13 session_set_cookie_params(60*60);
\r
14 $sqltext="select OrderID,CustomerID,ShipName,ShipCity,ShipCountry,OrderDate,ShippedDate from orders order by OrderID";
\r
15 if (isset($_GET["id"])) {
\r
16 OpenDB(); // the addQuotes function requires a db connection when using MySQL
\r
17 $id=trim($_GET["id"]);
\r
18 if (strlen($id) == 5) $sqltext.=" where CustomerID=".$GLOBALS['oDB']->addQuotes($id);
\r
21 $_SESSION['ex2']=$sqltext;
\r
23 <link href="../demo.css" type="text/css" rel="stylesheet" />
\r
25 <script type='text/javascript'>
\r
27 var orderGrid,buffer;
\r
29 Rico.onLoad( function() {
\r
31 menuEvent : 'click',
\r
33 highlightElem: 'cursorRow',
\r
34 columnSpecs : [,,,,,{type:'date'},{type:'date'}]
\r
36 buffer=new Rico.Buffer.AjaxSQL('ricoQuery.php', {fmt:'json', TimeOut:<?php print array_shift(session_get_cookie_params())/60 ?>});
\r
37 orderGrid=new Rico.LiveGrid ('ex2', buffer, opts);
\r
38 orderGrid.menu=new Rico.GridMenu({});
\r
43 <style type="text/css">
\r
52 <table id='explanation' border='0' cellpadding='0' cellspacing='5' style='clear:both'><tr valign='top'><td>
\r
54 <script type='text/javascript'>
\r
55 document.write(Rico.Lib+' '+Rico.LibVersion);
\r
58 This example uses AJAX to fetch order data, as required, from the server.
\r
59 Notice how the number of visible rows is set automatically based
\r
60 on the size of the window. Try the different grid styles that
\r
62 Click on a cell to see available actions.
\r
63 <a href='ricoQuery.php?id=ex2&offset=0&page_size=10&_fmt=json'>View the AJAX response (JSON)</a>
\r
64 (requires JSONview or similar extension in FF).
\r
73 <p class="ricoBookmark"><span id='ex2_timer' class='ricoSessionTimer'></span><span id="ex2_bookmark"> </span></p>
\r
74 <table id="ex2" class="ricoLiveGrid" cellspacing="0" cellpadding="0">
\r
76 <col style='width:40px;' >
\r
77 <col style='width:60px;' >
\r
78 <col style='width:150px;'>
\r
79 <col style='width:80px;' >
\r
80 <col style='width:90px;' >
\r
81 <col style='width:100px;'>
\r
82 <col style='width:100px;'>
\r
89 <th>Ship Country</th>
\r
95 <textarea id='ex2_debugmsgs' rows='5' cols='80'></textarea>
\r