cvs: peardoc /en/package/structures structures-datagrid.xml /en/package/structures/structures-datagrid faq.xml
| From: | Mark Wiesemann | Date: | Wed, 16 Aug 2006 21:10:01 +0000 |
| Subject: | cvs: peardoc /en/package/structures structures-datagrid.xml /en/package/structures/structures-datagrid faq.xml | ||
| Groups: | php.pear.doc | ||
| Request: | Send a blank email to pear-doc+get-8297@lists.php.net to get a copy of this message | ||
wiesemann Wed Aug 16 21:10:01 2006 UTC
Added files:
/peardoc/en/package/structures/structures-datagrid faq.xml
Modified files:
/peardoc/en/package/structures structures-datagrid.xml
Log:
- added a FAQ for the package
http://cvs.php.net/viewvc.cgi/peardoc/en/package/structures/structures-datagrid.xml?r1=1.32&r2=1.33&diff_format=u
Index: peardoc/en/package/structures/structures-datagrid.xml
diff -u peardoc/en/package/structures/structures-datagrid.xml:1.32
peardoc/en/package/structures/structures-datagrid.xml:1.33
--- peardoc/en/package/structures/structures-datagrid.xml:1.32 Sun Jul 30 14:39:04 2006
+++ peardoc/en/package/structures/structures-datagrid.xml Wed Aug 16 21:10:01 2006
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1" ?>
-<!-- $Revision: 1.32 $ -->
+<!-- $Revision: 1.33 $ -->
<sect1 id="package.structures.structures-datagrid">
<title>Structures_DataGrid</title>
<!--
@@ -35,6 +35,7 @@
<sect2 id="package.structures.structures-datagrid.intro-and-features">
<title>Introduction and Features</title>
&package.structures.structures-datagrid.intro;
+ &package.structures.structures-datagrid.faq;
&package.structures.structures-datagrid.installation;
&package.structures.structures-datagrid.constants;
&package.structures.structures-datagrid.datasources;
http://cvs.php.net/viewvc.cgi/peardoc/en/package/structures/structures-datagrid/faq.xml?view=markup&rev=1.1
Index: peardoc/en/package/structures/structures-datagrid/faq.xml
+++ peardoc/en/package/structures/structures-datagrid/faq.xml
<?xml version="1.0" encoding="iso-8859-1" ?>
<!-- $Revision: 1.1 $ -->
<refentry id="package.structures.structures-datagrid.faq">
<refnamediv>
<refname>FAQ</refname>
<refpurpose>Answers to most Frequently Asked Questions</refpurpose>
</refnamediv>
<refsect1 id="package.structures.structures-datagrid.faq.desc">
&title.desc;
<para>
This document is based on questions asked on <ulink url="mailto:&email.pear.general;">PEAR
general mailing list</ulink> and other mailing lists and forums.
</para>
</refsect1>
<refsect1 id="package.structures.structures-datagrid.faq.content">
<title>Structures_DataGrid FAQ</title>
<qandaset>
<qandaentry>
<question>
<para>
I'm using the HTML_Table Renderer. How can I use multiple grids on the
same page?
</para>
</question>
<answer>
<para>
The <link
linkend="package.structures.structures-datagrid.structures-datagrid.setrequestprefix"><function>setRequestPrefix</function></link>
method is the solution for this problem. Each DataGrid for the page needs
such a prefix that is internally used before the GET parameters for sorting
and paging. An example of the usage:
<programlisting role="php">
<![CDATA[
require_once 'Structures/DataGrid.php';
$datagrid1 = new Structures_DataGrid();
$datagrid2 = new Structures_DataGrid();
$datagrid1->bind('SELECT * FROM trade', array('dsn' => DSN));
$datagrid2->bind('SELECT * FROM stock', array('dsn' => DSN));
$datagrid1->setRequestPrefix('trade_');
$datagrid2->setRequestPrefix('stock_');
$datagrid1->render();
$datagrid2->render();
]]>
</programlisting>
</para>
<note>
<para>
You need to call <function>setRequestPrefix</function>
before calling
<link
linkend="package.structures.structures-datagrid.structures-datagrid.bind"><function>bind</function></link>.
</para>
</note>
</answer>
</qandaentry>
<qandaentry>
<question>
<para>
Which DataSource drivers are recommended?
</para>
</question>
<answer>
<para>
Currently there are four DataSource drivers that are recommended in the
sense of efficiency:
</para>
<itemizedlist>
<listitem>
<para>
DB_DataObject
</para>
</listitem>
<listitem>
<para>
DB_Table
</para>
</listitem>
<listitem>
<para>
DBQuery
</para>
</listitem>
<listitem>
<para>
MDB2
</para>
</listitem>
</itemizedlist>
<para>
These four drivers will only fetch the needed records from the database.
For example, if you have a row limit of 15 records per page, they will
only fetch (up to) 15 records.
</para>
<para>
All other DataSource drivers can, of course, also be used. But there is
no logic implemented (better said: implementable) to avoid fetching (or
keeping in memory) unneeded records.
</para>
</answer>
</qandaentry>
<qandaentry>
<question>
<para>
I'd like to add row numbers to my DataGrid. How can I do this?
</para>
</question>
<answer>
<para>
You need a <link
linkend="package.structures.structures-datagrid.formatter">formatter</link>
for the new column that should hold the row number. The first parameter
that is passed to such a formatter function contains a
<emphasis>currRow</emphasis> value with the row number per page. For
calculating the row number relative to the whole table, you need to take
also the <link
linkend="package.structures.structures-datagrid.structures-datagrid.getcurrentrecordnumberstart"><function>getCurrentRecordNumberStart</function></link>
method into account.
</para>
<para>
The following code snippet shows you how to define the formatter function
and how to add the column (with <emphasis>#</emphasis> as the column label
and right aligned values):
<programlisting role="php">
<![CDATA[
function formatRowNumber($params, $recordNumberStart)
{
return $params['currRow'] + $recordNumberStart;
}
$datagrid->addColumn(
new Structures_DataGrid_Column(
'#',
null,
null,
array('style' => 'text-align: right;'),
null,
'formatRowNumber',
$datagrid->getCurrentRecordNumberStart()
));
]]>
</programlisting>
</para>
</answer>
</qandaentry>
<qandaentry>
<question>
<para>
I'm using the Excel Renderer and would like to have the € sign in
the resulting Excel file, but I always get only a box or some funny
characters. How can I get the right € sign?
</para>
</question>
<answer>
<para>
Instead of using an encoding like ISO-8859-15, you need to use
Windows-1252.
</para>
</answer>
</qandaentry>
</qandaset>
</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-executeMultiple-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
-->