Structures_DataGrid::fill()
-- Fill a rendering container with data
Описание
Этот пакет пока не документирован.
Параметр
- 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
Возвращаемое значение
returns
Either true or a PEAR_Error object
Throws
throws
no exceptions thrown
Examples
Пример 58-1. 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();
?> |
|
Пример 58-2. 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();
?> |
|
Заметка
Эта функция не должна вызываться статически.