Datagrid and sorting/paging II
| From: | Bernhard Harb | Date: | Sat, 07 Jun 2008 19:37:35 +0000 |
| Subject: | Datagrid and sorting/paging II | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-28982@lists.php.net to get a copy of this message | ||
This is my sample code:
$datagrid =& new Structures_DataGrid(5);
$params = array('dsn' => 'mysql://'.$options['db']['user'].':'.$options['db']['password'].'@'.$options['db']['server'].'/'.$options['db']['database']);
$usergrid = $datagrid->bind('SELECT iduser, username, email FROM user', $params, 'MDB2');
$datagrid->setRequestPrefix('usrtbl_');
$renderer =& $datagrid->getRenderer();
$pager = $renderer->getPaging();
if (PEAR::isError($usergrid)) {
echo $usergrid->getMessage();} $usergrid = $datagrid->getOutput(); I use getOutput() because I write the Output to a Smarty-Template. Thanks, Bernhard.