cvs: pear /Structures_DataGrid/DataGrid/Docs/Examples example.php

From: Date: Fri, 22 Oct 2004 15:36:57 +0000
Subject: cvs: pear /Structures_DataGrid/DataGrid/Docs/Examples example.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-25063@lists.php.net to get a copy of this message
asnagy Fri Oct 22 11:36:57 2004 EDT Modified files: /pear/Structures_DataGrid/DataGrid/Docs/Examples example.php Log: Added sorticon and options for binding http://cvs.php.net/diff.php/pear/Structures_DataGrid/DataGrid/Docs/Examples/example.php?r1=1.6&r2=1.7&ty=u Index: pear/Structures_DataGrid/DataGrid/Docs/Examples/example.php diff -u pear/Structures_DataGrid/DataGrid/Docs/Examples/example.php:1.6 pear/Structures_DataGrid/DataGrid/Docs/Examples/example.php:1.7 --- pear/Structures_DataGrid/DataGrid/Docs/Examples/example.php:1.6 Tue Aug 10 11:18:35 2004 +++ pear/Structures_DataGrid/DataGrid/Docs/Examples/example.php Fri Oct 22 11:36:57 2004 @@ -9,6 +9,7 @@ <?php require_once('Structures/DataGrid.php'); +require_once('Structures/DataGrid/Source.php'); class Printer { function printLink($params) @@ -60,6 +61,9 @@ $dg->renderer->setTableAttribute('cellpadding', '4'); $dg->renderer->setTableAttribute('class', 'datagrid'); +$dg->renderer->sortIconASC = "&uArr;"; +$dg->renderer->sortIconDESC = "&dArr;"; + // Set empty row table attributes $dg->renderer->allowEmptyRows(true, array('bgcolor' => '#FFFFFF')); @@ -74,7 +78,8 @@ $column = new Structures_DataGrid_Column('Delete', null, null, array('align' => 'center')); $dg->addColumn($column); -// Add rows to the DataGrid +/* Add rows to the DataGrid +Option #1 foreach ($rs as $row) { $row = new Structures_DataGrid_Record($row); $result = $dg->addRecord($row); @@ -82,6 +87,16 @@ echo $result->getMessage(); } } +*/ + +/* Bind a datasource object +Option #2 +$source = Structures_DataGrid_DataSource::create($rs); +$dg->bindDataSource($source); +*/ + +// Option #3 Bind directly to any data type +$dg->bind($rs); // Sort the array based on the field if (isset($_GET['orderBy'])) { @@ -93,13 +108,5 @@ echo $dg->renderer->getPaging(); ?> -<p> - View as: - <b>HTML Table</b> | - <a href="example-xls.php">Excel Spreadsheet</a> | - <a href="example-xml.php">XML Document</a> | - <a href="example-smarty.php">Smarty Template</a> -</p> - </body> </html>

« previous php.pear.cvs (#25063) next »