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

From: Date: Mon, 16 Aug 2004 15:34:26 +0000
Subject: cvs: pear /Structures_DataGrid/DataGrid/Docs/Examples example-xul.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-22976@lists.php.net to get a copy of this message
asnagy Mon Aug 16 11:34:26 2004 EDT Added files: /pear/Structures_DataGrid/DataGrid/Docs/Examples example-xul.php Log: Initial Checkin http://cvs.php.net/co.php/pear/Structures_DataGrid/DataGrid/Docs/Examples/example-xul.php?r=1.1&p=1 Index: pear/Structures_DataGrid/DataGrid/Docs/Examples/example-xul.php +++ pear/Structures_DataGrid/DataGrid/Docs/Examples/example-xul.php <?php require_once('Structures/DataGrid.php'); // Data to be printed by DataGrid $rs = array(array('id' => 1, 'first_name' => 'Bob', 'last_name' => 'Smith', 'age' => '37'), array('id' => 2, 'first_name' => 'John', 'last_name' => 'Doe', 'age' => '23'), array('id' => 3, 'first_name' => 'Fred', 'last_name' => 'Thompson', 'age' => '58'), array('id' => 3, 'first_name' => 'Sally', 'last_name' => 'Robinson', 'age' => '52'), array('id' => 3, 'first_name' => 'Robert', 'last_name' => 'Brown', 'age' => '19')); // Define New DataGrid with a limit of 3 records $dg = new Structures_DataGrid(3, null, DATAGRID_RENDER_XUL); // Define columns for the DataGrid $column = new Structures_DataGrid_Column('Name', 'first_name'); $dg->addColumn($column); $column = new Structures_DataGrid_Column('Age', 'age'); $dg->addColumn($column); // Add rows to the DataGrid foreach ($rs as $row) { $row = new Structures_DataGrid_Record($row); $result = $dg->addRecord($row); if (PEAR::isError($result)) { echo $result->getMessage(); } } // Sort the array based on the field $dg->sortRecordSet('age', 'DESC'); // Print the DataGrid $dg->render(); ?>

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