Structures_DataGrid::fill
Synopsis
mixed
Structures_DataGrid::fill
(
object
&$container
,
array
$options = array()
,
string
$type
= null
)
Description
This package is not documented yet.
Parameter
-
object
&$container
-
A rendering container of any of the supported types (example: an HTML_Table object, a Spreadsheet_Excel_Writer object, etc...)
-
array
$options
-
Options for the corresponding rendering driver
-
string
$type
-
Explicit type in case the container type can't be detected
Return value
returns Either true or a PEAR_Error object
Throws
throws no exceptions thrown
Examples
Filling a Pager object
<?php
require_once 'Pager/Pager.php';
// Create a Pager object with your own options
$pager =& Pager::factory($options);
// fill() sets the $pager object up, according to your data and settings
$datagrid->fill($pager);
// Render the paging links
echo $pager->links;
// Or a select field if you like that
echo $pager->getpageselectbox();
?>
Fill a form with sort fields
<?php
require_once 'HTML/QuickForm.php';
// Create an empty form with your settings
$form = new HTML_QuickForm('myForm', 'POST');
// Customize it, add a header, text field, etc..
$form->addElement('header', null, 'Search & Sort Form Example');
$form->addElement('text', 'my_search', 'Search for:');
// Let the datagrid add sort fields, radio style
$options = array('directionStyle' => 'radio');
$datagrid->fill($form, $options, 'HTMLSortForm');
// You must add a submit button. fill() never does this
$form->addElement('submit', null, 'Submit');
// Use the native HTML_QuickForm::display() to print your form
$form->display();
?>
Note
This function can not be called statically.