Structures_DataGrid::bindDataSource()

Structures_DataGrid::bindDataSource() -- Binds a Structures_DataGrid_DataSource object to the DataGrid.

概要

object bindDataSource (Structures_DataGrid_DataSource $source)

説明

Binds a Structures_DataGrid_DataSource object to the DataGrid.

パラメータ

Structures_DataGrid_DataSource $source

The DataSource object

返り値

mixed - TRUE upon success otherwise a PEAR_Error upon failure

例 54-1Bind 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();
?>