Добро пожаловать на форум PHP программистов!
За последние 24 часа нас посетили 16434 программиста и 1673 робота. Сейчас ищут 1563 программиста ...

Structures_DataGrid_Renderer_HTMLEditForm

Вернуться к: Renderer drivers

Structures_DataGrid_Renderer_HTMLEditForm

Structures_DataGrid_Renderer_HTMLEditForm – HTML form to edit a record

This driver is experimental and has not been officially released yet. It is only available from SVN.

Supported operations modes

This driver supports the following operation modes:

Supported operations modes of this driver
Mode Supported?
Container Support yes
Output Buffering yes
Direct Rendering no
Streaming no
Object Preserving no

Options

This driver accepts the following options:

Options for this driver
Option Type Description Default Value
buildFooter bool Whether to build the footer. true
buildHeader bool Whether to build the header. true
defaultCellValue string What value to put by default into empty cells. null
defaultColumnValues array Per-column default cell value. This is an array of the form: array(fieldName => value, ...). array()
encoding string The content encoding. If the mbstring extension is present the default value is set from mb_internal_encoding(), otherwise it is ISO-8859-1. 'ISO-8859-1'
excludeVars array Variables to be removed from the generated HTTP queries. array()
extraVars array Variables to be added to the generated HTTP queries. array()
fillWithEmptyRows bool Ensures that all pages have the same number of rows. false
hideColumnLinks array By default sorting links are enabled on all columns. With this option it is possible to disable sorting links on specific columns. This is an array of the form: array(fieldName, ...). This option only affects drivers that support sorting. array()
numberAlign bool Whether to right-align numeric values. true
onMove string Name of a Javascript function to call on onclick/onsubmit events when the user is either paging or sorting the data. This function receives a single object argument of the form: { page: <page>, sort: [{field: <field>, direction: <direction>}, ...], data: <user_data> }. Remark: setting this option doesn't remove the href attribute, you should return false from your handler function to void it (eg: for AJAX, etc..). null
onMoveData string User data passed in the "data" member of the object argument passed to onMove. No JSON serialization is performed, this is assigned as a raw string to the "data" attribute. It's up to you to add quotes, slashes, etc... ''
textSubmit string Label for the submit button 'Submit'

Examples

Basic usage

<?php
require_once 'Structures/DataGrid.php';

$datagrid =& new Structures_DataGrid();
$datagrid->bind(...);  // bind your data here

$datagrid->setRenderer('HTMLEditForm');

$datagrid->render();
?>

Usage with tableless renderer and DHTMLRules

<?php
// don't forget to include the stylesheet to get a reasonable layout

require_once 'Structures/DataGrid.php';
require_once 
'HTML/QuickForm/DHTMLRulesTableless.php';
require_once 
'HTML/QuickForm/Renderer/Tableless.php';

$datagrid =& new Structures_DataGrid();
$datagrid->bind(...);  // bind your data here

// create the form object, using DHTMLRules
$form = new HTML_QuickForm_DHTMLRulesTableless('editform'nullnull,
                                               
nullnulltrue);
$form->removeAttribute('name');  // for XHTML validity

// to get a legend for the fieldset, we add a header element
$form->addElement('header''header''EditForm example');

// fill() makes the renderer to generate the needed form elements
$datagrid->fill($formnull'HTMLEditForm');

// we have to add a submit button ourselves
$form->addElement('submit'null'Submit');

// to show the DHTMLRules functionality, we add a required rule
// (we assume that there is an element with name 'id')
$form->addRule('id''Please enter the ID.''required'null'client');

// to get validation onChange/onBlur events, we need the following call
$form->getValidationScript();

// instantiate the tableless renderer and output the form
$renderer =& new HTML_QuickForm_Renderer_Tableless();
$form->accept($renderer);
echo 
$renderer->toHtml();
?>


Вернуться к: Renderer drivers

© 2024 «PHP.RU — Сообщество PHP-Программистов»
Главная | Форум | Реклама на сайте | Контакты VIP Сувениры
Разработка компании ODware