Structures_DataGrid::bindDataSource() -- Binds a Structures_DataGrid_DataSource object to the DataGrid.
Parameter
- Structures_DataGrid_DataSource
$source
The DataSource object
Return value
mixed - TRUE upon success otherwise a PEAR_Error upon failure
Example
Example 55-1. Bind datagrid to a DB_Result Object <?php
require 'Structures/DataGrid.php';
require 'Structures/DataGrid/DataSource.php';
$dg =& new Structures_DataGrid();
// Get my data
$result = $db->query('SELECT * FROM users');
// Bind to DataGrid
$data = Structures_DataGrid_DataSource::create($result);
$dg->bindDataSource($data);
// Print the DataGrid
$dg->render();
?> |
|