View this page in Japanese
Both types of grids share some common features, including:
Rico provides lots of support for loading a LiveGrid buffer. The buffer can can be loaded from:
To simplify the task of loading a LiveGrid with SQL query results, Rico comes with a set of "plug-ins" which connect your database to your LiveGrid. Rico plug-ins have been tested with the following databases:
|MySQL||Oracle||DB2||SQL Server||MS Access|
Rico plug-in/database compatibility as of Nov 2007
* The ASP plug-in uses ADO and the .net plug-in uses ADO.net,
and thus should be able to connect with any data source that is compatible with ADO
Finally, if your users are allowed to make changes to the data, the Rico plug-ins make that easy too. Just define your grid using LiveGrid Forms -- Add, Edit, and Delete record selections will be added to the grid's context (popup) menu.
If it sounds complicated, don't worry! All of this work is handled by the plug-in. See the "ex2edit" example for a demonstration of how easy it is, both for the user and the programmer. "ex4edit" demonstrates how to make multiple grids on a page editable.
While plug-ins make it easy to load data into a LiveGrid, they are not required. A LiveGrid buffer can be loaded with XML data from any source, as long as the data follows this format:
<ajax-response> <response type='object' id='MyGridId_updater'> <rows update_ui='true' offset='0'> <tr><td>Data for row 1, cell 1</td><td>Data for row 1, cell 2</td></tr> <tr><td>Data for row 2, cell 1</td><td>Data for row 2, cell 2</td></tr> </rows> </response> </ajax-response>
See the weather and photo examples, which retrieve data from Yahoo Weather and Flickr respectively and reformat the data into the structure shown above. These examples are currently available in PHP and .net versions, but not ASP.
SimpleGrid's are new to Rico 2.0 and share some of the same functionality as LiveGrids - resizable columns, frozen columns, and frozen headings. However, unlike a LiveGrid, the data is static and resides in the DOM - so no buffering, no AJAX refreshes, no sorting, no filtering. Why would you use a SimpleGrid?
The most sophisticated example of a SimpleGrid is the spreadsheet included with this distribution. You can enter formulas and it will recalculate when you change the inputs - just like a commercial spreadsheet. A link to the spreadsheet example can be found under the "HTML Examples" section of the examples menu. When in the spreadsheet, click the button to see all it can do.
SimpleGrids can be created either of two ways:
Each plug-in defines a SimpleGrid class. Within the class, there are methods to start header rows and data rows - just call one of these methods everywhere you would put a <tr> tag in an HTML table. There is also a method to create a cell - just call it everywhere you would put a <th> or <td> tag in an HTML table. When you are done defining the table content, just call the render method (except in the .net plugin where render is called automatically). It's that easy!
If your web page is XHTML compliant, then there is another way to generate a SimpleGrid. Just use the XSL stylesheet "ricoSimpleGrid.xsl" to transform tables in your page to SimpleGrids. The stylesheet looks for tables with a class name of "ricoSimpleGrid" and then does the transformation for you. At one time, Rico supported doing this transformation on the client. However, due to changes in the Prototype library, this is no longer possible. Therefore, if you choose to use this approach, the XSLT transform must be performed on the server.