Datagrid - possible bug (paging / sorting)
| From: | Toppi | Date: | Mon, 22 May 2006 21:41:45 +0000 |
| Subject: | Datagrid - possible bug (paging / sorting) | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-24113@lists.php.net to get a copy of this message | ||
Hi,
i more or less took the example by Olivier
(http://www.samalyse.com/code/pear/dgdo/),
to get a quick look at Datagrid.
I am using the following source (with the current cvs version of datagrid).
when i now click on one of the column headers datagrid should sort the
table, but instead of sorting it just jumps back to page1.
am i doing something wrong.. or is it a bug?
greetings,
Toppi
---
<style type="text/css">
body {
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size: 11px;
}
table.standard {
border-left: solid 1px #990033;
border-top: solid 1px #990033;
border-bottom: solid 1px #990033;
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size: 11px;
border-collapse: collapse;
width: 36em;
margin-left: 1em;
}
table.standard th {
text-align: center;
border-right: solid 1px #990033;
border-bottom: solid 1px #990033;
background: #990033;
padding: 2px;
color: white;
padding-left: 1em;
padding-right: 1em;
}
table.standard th a {
color: white;
text-decoration: none;
}
table.standard th a:hover {
color: #EEEEEE;
}
table.standard td {
text-align: right;
border-right: solid 1px #990033;
padding: 2px;
}
table.standard tr.odd {
background: #F4F4F4;
}
p.paging {
text-align: center;
font-weight: bold;
}
p.paging a {
color: #990033;
}
</style>
<?php
require 'Structures/DataGrid.php';
// 10 records per page
$datagrid =& new Structures_DataGrid(10);
// Setup your datasource
$options = array('dsn' =>
'mysql://root:pass123@127.0.0.1/information_schema');
$test = $datagrid->bind("SELECT * FROM STATISTICS", $options, "DBQuery");
if (PEAR::isError($test)) {
echo $test->getMessage();
}
/*
// Print the DataGrid with the default renderer (HTML Table)
$test = $datagrid->render();
if (PEAR::isError($test)) {
echo $test->getMessage();
}
// Print the HTML paging links
$test = $datagrid->render(DATAGRID_RENDER_PAGER);
if (PEAR::isError($test)) {
echo $test->getMessage();
}
*/
$renderer =& $datagrid->getRenderer();
/* For the <table> element : */
$renderer->setTableAttribute("class", "standard");
/* For every odd <tr> elements */
$renderer->setTableOddRowAttributes(array ("class" => "odd"));
$pagingHtml = $renderer->getPaging();
echo "<p class=\"paging\">Pages : $pagingHtml</p>";
$datagrid->render();
?>
---
.