cvs: peardoc /en/package/structures/structures-datagrid formatter.xml
| From: | Andrew Nagy | Date: | Mon, 04 Apr 2005 17:31:12 +0000 |
| Subject: | cvs: peardoc /en/package/structures/structures-datagrid formatter.xml | ||
| Groups: | php.pear.doc | ||
| Request: | Send a blank email to pear-doc+get-5873@lists.php.net to get a copy of this message | ||
asnagy Mon Apr 4 13:31:12 2005 EDT
Added files:
/peardoc/en/package/structures/structures-datagrid formatter.xml
Log:
http://cvs.php.net/co.php/peardoc/en/package/structures/structures-datagrid/formatter.xml?r=1.1&p=1
Index: peardoc/en/package/structures/structures-datagrid/formatter.xml
+++ peardoc/en/package/structures/structures-datagrid/formatter.xml
<?xml version="1.0" encoding="iso-8859-1" ?>
<!-- $Revision: 1.1 $ -->
<refentry id="package.structures.structures-datagrid.formatter">
<refnamediv>
<refname>Column Formatter</refname>
<refpurpose>What can I do with the column formatter?</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<para>
The column formatter method can be a very powerful solution to a very
common need. The need is to customize the output for a cell in the grid
such as a link for a form element. This can be easily done by specifying
a "callback" function. This function will then return the string that is
needed to be printed.
</para>
<example>
<title>Using the column formatter</title>
<programlisting role="php">
<![CDATA[
<?php
require_once('Structures/DataGrid.php');
$dg =& new Structures_DataGrid();
$dg->bind('http://pear.php.net/feeds/pkg_structures_datagrid.rss',
null, 'RSS');
$dg->addColumn(new Structures_DataGrid_Column('Release', 'title',
'title', null, null, 'printLink()'));
$dg->addColumn(new Structures_DataGrid_Column('Description',
'description', 'description'));
$dg->addColumn(new Structures_DataGrid_Column('Date', 'dc:date',
'dc:date'));
$dg->render();
function printLink($params)
{
extract($params);
return '<a href="' . $record['link'] . '">'
. $record['title'] . '</a>';
}
?>
</programlisting>
</example>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->